[java-idp-plugin-oidc-rp] branch dev/JOIDCRP-29 updated: JOIDCRP-29 - Support client_secret_jwt and private_key_jwt client authentication

Phil Smart philip.smart at jisc.ac.uk
Tue Jun 20 14:14:21 UTC 2023


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch dev/JOIDCRP-29
in repository java-idp-plugin-oidc-rp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=c0c9bc39e19fc1b0527e45ab4ffa2fe58ee3afe3

The following commit(s) were added to refs/heads/dev/JOIDCRP-29 by this push:
     new c0c9bc3  JOIDCRP-29 - Support client_secret_jwt and private_key_jwt client authentication
c0c9bc3 is described below

commit c0c9bc39e19fc1b0527e45ab4ffa2fe58ee3afe3
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Jun 20 15:14:18 2023 +0100

    JOIDCRP-29 - Support client_secret_jwt and private_key_jwt client
    authentication
    
     - Move in commons class to the RP
    
    https://shibboleth.atlassian.net/browse/JOIDCRP-29
---
 ...viderMetadataStringListValueLookupFunction.java | 87 ++++++++++++++++++++++
 .../META-INF/net.shibboleth.idp/postconfig.xml     | 10 +++
 .../oidc-relying-party-authn-beans.xml             |  2 +-
 pom.xml                                            |  2 +-
 4 files changed, 99 insertions(+), 2 deletions(-)

diff --git a/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/navigate/ProviderMetadataStringListValueLookupFunction.java b/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/navigate/ProviderMetadataStringListValueLookupFunction.java
new file mode 100644
index 0000000..2e3ae53
--- /dev/null
+++ b/idp-oidc-rp-api/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/navigate/ProviderMetadataStringListValueLookupFunction.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.authn.oidc.rp.config.navigate;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata;
+
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
+/**
+ * Fetches the value for the configured key as List of {@link String}s. May be {@code null} if the value is not found 
+ * or the given {@link OIDCProviderMetadata} is null.
+ */
+public class ProviderMetadataStringListValueLookupFunction implements Function<OIDCProviderMetadata, List<String>> {
+
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(ProviderMetadataStringListValueLookupFunction.class);
+
+    /** The key for which to fetch the value for. */
+    @Nonnull private final String keyName;
+
+    /**
+     * Constructor.
+     *
+     * @param name The key for which to fetch the value for.
+     */
+    public ProviderMetadataStringListValueLookupFunction(@ParameterName(name = "keyName") @Nonnull final String name) {
+        keyName = Constraint.isNotEmpty(name, "The key name cannot be empty");
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    @Nullable public List<String> apply(@Nullable final OIDCProviderMetadata metadata) {
+        if (metadata == null) {
+            log.trace("No provider metadata available");
+            return null;
+        }
+        final Object value = metadata.toJSONObject().get(keyName);
+        if (value == null) {
+            log.trace("No value found for the key {}", keyName);
+            return null;
+        }
+        if (value instanceof String) {
+            return List.of((String)value);
+        }
+        if (value instanceof List) {
+            final List<?> valueAsList = (List<?>)value;
+            return Collections.unmodifiableList(valueAsList.stream()
+                    .filter(Objects::nonNull)
+                    .filter(String.class::isInstance)
+                    .map(String.class::cast)
+                    .filter(Predicate.not(String::isEmpty))
+                    .collect(Collectors.toList()));
+        }
+        
+        return null;
+    }
+
+}
diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index 9e12642..314efaf 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -164,6 +164,16 @@
             <ref bean="shibboleth.MessageContextLookup.Outbound" />
         </constructor-arg>
     </bean>
+    
+    <bean id="shibboleth.ChildLookupOrCreate.SecurityParametersContextInAccessTokenResponseContext" 
+            parent="shibboleth.Functions.Compose">
+        <constructor-arg name="g">
+            <ref bean="shibboleth.ChildLookupOrCreate.SecurityParametersContext" />
+        </constructor-arg>
+        <constructor-arg name="f">
+            <ref bean="shibboleth.ChildLookup.AccessTokenResponseContext" />
+        </constructor-arg>
+    </bean>
         
     <bean id="shibboleth.MessageLookup.AuthenticationResponse"
         class="org.opensaml.messaging.context.navigate.MessageLookup"
diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
index 90338bf..4d7b50e 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
@@ -398,7 +398,7 @@
 					               scope="prototype">
 					               <property name="providerMetadataAlgorithmLookupStrategy">					                 
 		                                <bean
-		                                    class="net.shibboleth.oidc.profile.config.navigate.ProviderMetadataStringListValueLookupFunction"
+		                                    class="net.shibboleth.idp.plugin.authn.oidc.rp.config.navigate.ProviderMetadataStringListValueLookupFunction"
 		                                    c:keyName="token_endpoint_auth_signing_alg_values_supported" />                           
 					               </property>
 					               </bean>
diff --git a/pom.xml b/pom.xml
index 30fbeaa..5288311 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
         <opensaml.version>4.3.0</opensaml.version>
         <java-support.version>8.4.0</java-support.version>
         <spring-extensions.version>6.3.0</spring-extensions.version>  
-        <oidc.common.version>2.2.2-SNAPSHOT</oidc.common.version>
+        <oidc.common.version>2.2.0</oidc.common.version>
         <idp.oidc.config.version>1.0.0</idp.oidc.config.version>
         <okhttp3.mockserver.version>4.9.3</okhttp3.mockserver.version>
         <okhttp3.tls.version>4.9.3</okhttp3.tls.version>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list