[java-idp-oidc] branch dev/JOIDC-5 updated: JOIDC-5 Refactoring: got rid of OIDCSAMLPeerEntityContext.
Henri Mikkonen
henri.mikkonen at iki.fi
Fri May 1 13:38:41 UTC 2020
This is an automated email from the git hooks/post-receive script.
hjmikkon pushed a commit to branch dev/JOIDC-5
in repository java-idp-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=961684435604a292f0c21ce7c53f3c746dfe9b59
The following commit(s) were added to refs/heads/dev/JOIDC-5 by this push:
new 96168443 JOIDC-5 Refactoring: got rid of OIDCSAMLPeerEntityContext.
96168443 is described below
commit 961684435604a292f0c21ce7c53f3c746dfe9b59
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri May 1 16:34:40 2020 +0300
JOIDC-5 Refactoring: got rid of OIDCSAMLPeerEntityContext.
https://issues.shibboleth.net/jira/browse/JOIDC-5
No need for the "custom" SAMLPeerEntityContextClass, as it was meant
for dynamically resolving entityID (clientID) from the inbound OIDC
message. Now it's resolved and set earlier in the flow by action
'SetEntityIdToSAMLPeerEntityContext'.
---
.../context/OIDCSAMLPeerEntityContext.java | 89 ----------------------
.../oidc/metadata-lookup/metadata-lookup-beans.xml | 20 ++---
.../oidc/metadata-lookup/metadata-lookup-flow.xml | 2 +-
3 files changed, 7 insertions(+), 104 deletions(-)
diff --git a/idp-oidc-extension-api/src/main/java/org/geant/idpextension/oidc/messaging/context/OIDCSAMLPeerEntityContext.java b/idp-oidc-extension-api/src/main/java/org/geant/idpextension/oidc/messaging/context/OIDCSAMLPeerEntityContext.java
deleted file mode 100644
index f1f7f020..00000000
--- a/idp-oidc-extension-api/src/main/java/org/geant/idpextension/oidc/messaging/context/OIDCSAMLPeerEntityContext.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2017 - 2020, GÉANT
- *
- * Licensed 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 org.geant.idpextension.oidc.messaging.context;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.saml.common.messaging.context.AbstractAuthenticatableSAMLEntityContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.nimbusds.oauth2.sdk.AuthorizationRequest;
-import com.nimbusds.oauth2.sdk.TokenRequest;
-
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-
-/**
- * Subcontext that carries information about an OIDC peer entity.
- *
- * <p>
- * This context will often contain subcontexts, whose data is construed to be scoped to that peer entity.
- * </p>
- *
- * <p>
- * The method {@link #getEntityId()} will attempt to dynamically resolve the appropriate data
- * from the OIDC message held in the message context if the data has not been set statically
- * by the corresponding setter method. This evaluation will be attempted only if the this
- * context instance is an immediate child of the message context, as returned by {@link #getParent()}.
- * </p>
- */
-public class OIDCSAMLPeerEntityContext extends AbstractAuthenticatableSAMLEntityContext {
-
- /** Logger. */
- @Nonnull private Logger log = LoggerFactory.getLogger(OIDCSAMLPeerEntityContext.class);
-
- /** {@inheritDoc} */
- @Override
- @Nullable @NotEmpty public String getEntityId() {
- if (super.getEntityId() == null) {
- setEntityId(resolveEntityId());
- }
- return super.getEntityId();
- }
-
- /**
- * Dynamically resolve the OIDC peer entity ID from the OIDC protocol message held in
- * {@link MessageContext#getMessage()}.
- *
- * @return the entity ID, or null if it could not be resolved
- */
- @Nullable protected String resolveEntityId() {
- log.debug("Resolving issuer dynamically..");
- if (getParent() instanceof MessageContext) {
- final MessageContext parent = (MessageContext) getParent();
- if (parent.getMessage() instanceof AuthorizationRequest) {
- final AuthorizationRequest authzRequest = (AuthorizationRequest) parent.getMessage();
- log.debug("Found client ID {}", authzRequest.getClientID());
- return authzRequest.getClientID().getValue();
- } else if (parent.getMessage() instanceof TokenRequest) {
- final TokenRequest tokenRequest = (TokenRequest) parent.getMessage();
- if (tokenRequest.getClientAuthentication() != null) {
- log.debug("Found client ID {}", tokenRequest.getClientAuthentication().getClientID().getValue());
- return tokenRequest.getClientAuthentication().getClientID().getValue();
- } else {
- log.debug("Found client ID {}", tokenRequest.getClientID().getValue());
- return tokenRequest.getClientID().getValue();
- }
- } else {
- log.debug("Unsupported message type for dynamic resolution: {}", parent.getMessage());
- }
- }
- return null;
- }
-}
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-beans.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-beans.xml
index 17852c8f..43cbeab2 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-beans.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-beans.xml
@@ -16,14 +16,14 @@
<constructor-arg name="messageHandler">
<bean class="org.opensaml.saml.common.binding.impl.SAMLProtocolAndRoleHandler" scope="prototype"
p:protocol="http://openid.net/specs/openid-connect-core-1_0.html"
- p:role-ref="shibboleth.MetadataLookup.Role" p:entityContextClass="org.geant.idpextension.oidc.messaging.context.OIDCSAMLPeerEntityContext"/>
+ p:role-ref="shibboleth.MetadataLookup.Role" p:entityContextClass="org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext"/>
</constructor-arg>
</bean>
<bean id="SetEntityIdToSAMLPeerEntityContext"
class="org.geant.idpextension.oidc.profile.impl.SetEntityIdToSAMLPeerEntityContext"
p:clientIDLookupStrategy-ref="shibboleth.ClientIDLookupStrategy"
- p:entityContextClass="org.geant.idpextension.oidc.messaging.context.OIDCSAMLPeerEntityContext" />
+ p:entityContextClass="org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext" />
<bean id="InitializeRelyingPartyContext"
class="org.geant.idpextension.oidc.profile.impl.InitializeRelyingPartyContext" scope="prototype"
@@ -34,7 +34,7 @@
c:executionDirection="INBOUND">
<constructor-arg name="messageHandler">
<bean class="org.opensaml.saml.common.binding.impl.SAMLMetadataLookupHandler" scope="prototype"
- p:entityContextClass="org.geant.idpextension.oidc.messaging.context.OIDCSAMLPeerEntityContext">
+ p:entityContextClass="org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext">
<property name="roleDescriptorResolver">
<bean class="org.opensaml.saml.metadata.resolver.impl.PredicateRoleDescriptorResolver"
c:mdResolver-ref="shibboleth.MetadataResolver" />
@@ -43,21 +43,13 @@
</constructor-arg>
</bean>
- <bean id="shibboleth.ChildLookup.OIDCSAMLPeerEntityContext"
- class="org.opensaml.messaging.context.navigate.ChildContextLookup"
- c:type="#{ T(org.geant.idpextension.oidc.messaging.context.OIDCSAMLPeerEntityContext) }" />
-
- <bean id="shibboleth.ChildLookup.SAMLMetadataContext"
- class="org.opensaml.messaging.context.navigate.ChildContextLookup"
- c:type="#{ T(org.opensaml.saml.common.messaging.context.SAMLMetadataContext) }" />
-
- <bean id="LookupOIDCSAMLPeerEntityContext" class="com.google.common.base.Functions" factory-method="compose"
- c:g-ref="shibboleth.ChildLookup.OIDCSAMLPeerEntityContext"
+ <bean id="LookupSAMLPeerEntityContext" class="com.google.common.base.Functions" factory-method="compose"
+ c:g-ref="shibboleth.ChildLookup.SAMLPeerEntityContext"
c:f-ref="shibboleth.MessageContextLookup.Inbound"/>
<bean id="LookupSAMLMetadataContext" class="com.google.common.base.Functions" factory-method="compose"
c:g-ref="shibboleth.ChildLookup.SAMLMetadataContext"
- c:f-ref="LookupOIDCSAMLPeerEntityContext"/>
+ c:f-ref="LookupSAMLPeerEntityContext"/>
<bean id="PopulateOIDCMetadataContext"
class="org.geant.idpextension.oidc.profile.impl.PopulateOIDCMetadataContext" scope="prototype"
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-flow.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-flow.xml
index 648464e7..5a66246e 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-flow.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/metadata-lookup/metadata-lookup-flow.xml
@@ -17,7 +17,7 @@
</action-state>
<decision-state id="CheckIfFoundFromSAMLMetadata">
- <if test="opensamlProfileRequestContext.getInboundMessageContext().getSubcontext(T(org.geant.idpextension.oidc.messaging.context.OIDCSAMLPeerEntityContext)).containsSubcontext(T(org.opensaml.saml.common.messaging.context.SAMLMetadataContext))"
+ <if test="opensamlProfileRequestContext.getInboundMessageContext().getSubcontext(T(org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext)).containsSubcontext(T(org.opensaml.saml.common.messaging.context.SAMLMetadataContext))"
then="PopulateOIDCMetadataContextFromSAML" else="LookupFromClientInformationService" />
</decision-state>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list