[java-plugin-shibd-saml] branch main updated: Replace with duplicate class from IdP.

Codeberg noreply at shibboleth.net
Tue Nov 17 20:25:32 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-plugin-shibd-saml.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd-saml/commit/db12479bcd8f925686412be4c084af5d073aec26

The following commit(s) were added to refs/heads/main by this push:
     new db12479  Replace with duplicate class from IdP.
db12479 is described below

commit db12479bcd8f925686412be4c084af5d073aec26
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Nov 17 15:25:01 2026 -0500

    Replace with duplicate class from IdP.
---
 .../idp/flows/sp/initiator/ecp/ecp-beans.xml       |   4 +-
 .../flows/saml2/ECPSessionInitiatorFlowTest.java   |   2 +-
 .../flows/saml2/SAML2TokenConsumerFlowTest.java    |   4 +-
 .../impl/InitializeOutboundMessageContext.java     | 170 ---------------------
 4 files changed, 5 insertions(+), 175 deletions(-)

diff --git a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/ecp/ecp-beans.xml b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/ecp/ecp-beans.xml
index 98e06c6..6c02beb 100644
--- a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/ecp/ecp-beans.xml
+++ b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/ecp/ecp-beans.xml
@@ -31,9 +31,9 @@
         p:treatAnonymousAsVerified="true" />
 
     <bean id="InitializeECPOutboundMessageContext"
-        class="net.shibboleth.sp.saml.saml2.profile.impl.InitializeOutboundMessageContext" scope="prototype"
+        class="net.shibboleth.idp.saml.profile.impl.InitializeOutboundMessageContext" scope="prototype"
         p:selfIdentityLookupStrategy-ref="shibboleth.IssuerLookup.Simple"
-        p:requirePeerIdentity="false" />
+        p:requirePeerContext="false" />
 
     <bean id="InitializePAOSBindingContext"
         class="net.shibboleth.sp.saml.saml2.profile.impl.InitializePAOSBindingContext" scope="prototype"
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/ECPSessionInitiatorFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/ECPSessionInitiatorFlowTest.java
index a056b9d..4f1a321 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/ECPSessionInitiatorFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/ECPSessionInitiatorFlowTest.java
@@ -255,7 +255,7 @@ public class ECPSessionInitiatorFlowTest extends AbstractSPFlowTest {
         final DDF headers = input.getmember(RemotedHttpServletRequest.STRUCTURE_NAME)
                 .addmember(RemotedHttpServletRequest.HEADERS).structure();
         
-        headers.addmember("Accept").unsafe_string(("text/html, " + SAML2InitiatorConstants.PAOS_MEDIA_TYPE).getBytes(StandardCharsets.UTF_8));
+        headers.addmember("Accept").unsafe_string(("text/html, " + SAMLConstants.PAOS_MEDIA_TYPE).getBytes(StandardCharsets.UTF_8));
         headers.addmember("PAOS").unsafe_string(builder.toString().getBytes(StandardCharsets.UTF_8));
     }
     
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
index daf8967..09a5ea3 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
@@ -30,6 +30,7 @@ import org.opensaml.core.xml.io.MarshallingException;
 import org.opensaml.core.xml.util.XMLObjectSupport;
 import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.saml.common.xml.SAMLConstants;
 import org.opensaml.saml.saml2.core.Assertion;
 import org.opensaml.saml.saml2.core.Attribute;
 import org.opensaml.saml.saml2.core.AttributeStatement;
@@ -106,7 +107,6 @@ import net.shibboleth.sp.messaging.RemotedHttpServletRequest;
 import net.shibboleth.sp.messaging.RemotedHttpServletResponse;
 import net.shibboleth.sp.profile.ConsumerConstants;
 import net.shibboleth.sp.saml.saml2.SAMLStateData;
-import net.shibboleth.sp.saml.saml2.profile.SAML2InitiatorConstants;
 import net.shibboleth.sp.saml.saml2.profile.impl.PrepareAgentResponse;
 import net.shibboleth.sp.saml.saml2.profile.impl.SessionDataSupport;
 import net.shibboleth.sp.state.StateData;
@@ -1080,7 +1080,7 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
             http.addmember(RemotedHttpServletRequest.HOSTNAME).unsafe_string("sp.example.org".getBytes(StandardCharsets.UTF_8));
             http.addmember(RemotedHttpServletRequest.METHOD).string("POST");
             http.addmember(RemotedHttpServletRequest.REMOTE_ADDR).string("192.168.1.1");
-            http.addmember(RemotedHttpServletRequest.CONTENT_TYPE).string(SAML2InitiatorConstants.PAOS_MEDIA_TYPE);
+            http.addmember(RemotedHttpServletRequest.CONTENT_TYPE).string(SAMLConstants.PAOS_MEDIA_TYPE);
             http.addmember(RemotedHttpServletRequest.REQUEST_URI).unsafe_string("/Shibboleth.sso/Validate".getBytes(StandardCharsets.UTF_8));
             
             if (stateCookie != null) {
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/InitializeOutboundMessageContext.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/InitializeOutboundMessageContext.java
deleted file mode 100644
index f1ffaf3..0000000
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/InitializeOutboundMessageContext.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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 net.shibboleth.sp.saml.saml2.profile.impl;
-
-import java.util.function.Function;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.BaseContext;
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.common.messaging.context.AttributeConsumingServiceContext;
-import org.opensaml.saml.common.messaging.context.SAMLMetadataContext;
-import org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext;
-import org.opensaml.saml.common.messaging.context.SAMLSelfEntityContext;
-import org.slf4j.Logger;
-
-import net.shibboleth.idp.profile.AbstractProfileAction;
-import net.shibboleth.idp.profile.IdPEventIds;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.context.navigate.IssuerLookupFunction;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.primitive.LoggerFactory;
-
-/**
- * Action that adds an outbound {@link MessageContext} and related SAML contexts to the {@link ProfileRequestContext}
- * based on the identity of a relying party accessed via a lookup strategy, by default an immediate child of the profile
- * request context.
- * 
- * <p>This is a copy of an IdP class that adds optionality to the existence of the peer via a flag, for ECP use.</p>
- * 
- * <p>
- * A {@link SAMLSelfEntityContext} is created based on the identity of the SP/Agent, as derived by a lookup strategy. A
- * {@link SAMLPeerEntityContext} and {@link SAMLMetadataContext} are created based on the {@link SAMLPeerEntityContext}
- * that underlies the {@link RelyingPartyContext}.
- * </p>
- * 
- * @event {@link EventIds#PROCEED_EVENT_ID}
- * @event {@link IdPEventIds#INVALID_RELYING_PARTY_CTX}
- */
-public class InitializeOutboundMessageContext extends AbstractProfileAction {
-
-    /** Class logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(InitializeOutboundMessageContext.class);
-
-    /** Relying party context lookup strategy. */
-    @Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategy;
-
-    /** Strategy used to obtain the self identity value. */
-    @Nonnull private Function<ProfileRequestContext,String> selfIdentityLookupStrategy;
-
-    /** Whether a peer identity is required or not. */
-    private boolean requirePeerIdentity;
-    
-    /** The {@link SAMLPeerEntityContext} to base the outbound context on. */
-    @Nullable private SAMLPeerEntityContext peerEntityCtx;
-
-    /** Constructor. */
-    public InitializeOutboundMessageContext() {
-        relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class);
-        selfIdentityLookupStrategy = new IssuerLookupFunction();
-        
-        requirePeerIdentity = true;
-    }
-
-    /**
-     * Set the relying party context lookup strategy.
-     * 
-     * @param strategy lookup strategy
-     */
-    public void setRelyingPartyContextLookupStrategy(
-            @Nonnull final Function<ProfileRequestContext, RelyingPartyContext> strategy) {
-        checkSetterPreconditions();
-        relyingPartyContextLookupStrategy =
-                Constraint.isNotNull(strategy, "RelyingPartyContext lookup strategy cannot be null");
-    }
-
-    /**
-     * Set the strategy used to locate the self identity value to use.
-     * 
-     * @param strategy lookup strategy
-     */
-    public void setSelfIdentityLookupStrategy(@Nonnull final Function<ProfileRequestContext, String> strategy) {
-        checkSetterPreconditions();
-        selfIdentityLookupStrategy = Constraint.isNotNull(strategy, "Self identity lookup strategy cannot be null");
-    }
-    
-    /**
-     * Sets whether the existence of the {@link SAMLPeerEntityContext} is required or not.
-     * 
-     * <p>Defaults to true.</p>
-     * 
-     * @param flag flag to set
-     */
-    public void setRequirePeerIdentity(final boolean flag) {
-        checkSetterPreconditions();
-        requirePeerIdentity = flag;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
-
-        if (!super.doPreExecute(profileRequestContext)) {
-            return false;
-        }
-        
-        final RelyingPartyContext relyingPartyCtx = relyingPartyContextLookupStrategy.apply(profileRequestContext);
-        final BaseContext identifyingCtx =
-                relyingPartyCtx != null ? relyingPartyCtx.getRelyingPartyIdContextTree() : null;
-        
-        if (identifyingCtx instanceof SAMLPeerEntityContext peer) {
-            peerEntityCtx = peer;
-        } else if (requirePeerIdentity) {
-            log.debug("{} No SAML peer entity context found via relying party context", getLogPrefix());
-            ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
-            return false;
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
-
-        final MessageContext msgCtx = new MessageContext();
-        profileRequestContext.setOutboundMessageContext(msgCtx);
-
-        final SAMLSelfEntityContext selfContext = msgCtx.ensureSubcontext(SAMLSelfEntityContext.class);
-        selfContext.setEntityId(selfIdentityLookupStrategy.apply(profileRequestContext));
-
-        if (peerEntityCtx != null) {
-            final SAMLPeerEntityContext localCopy = peerEntityCtx;
-            
-            final SAMLPeerEntityContext peerContext = msgCtx.ensureSubcontext(SAMLPeerEntityContext.class);
-            peerContext.setEntityId(localCopy.getEntityId());
-    
-            final SAMLMetadataContext inboundMetadataCtx = localCopy.getSubcontext(SAMLMetadataContext.class);
-            if (inboundMetadataCtx != null) {
-                final SAMLMetadataContext outboundMetadataCtx = peerContext.ensureSubcontext(SAMLMetadataContext.class);
-                outboundMetadataCtx.setEntityDescriptor(inboundMetadataCtx.getEntityDescriptor());
-                outboundMetadataCtx.setRoleDescriptor(inboundMetadataCtx.getRoleDescriptor());
-                final AttributeConsumingServiceContext acsCtx =
-                        inboundMetadataCtx.getSubcontext(AttributeConsumingServiceContext.class);
-                if (null != acsCtx) {
-                    outboundMetadataCtx.ensureSubcontext(AttributeConsumingServiceContext.class)
-                            .setAttributeConsumingService(acsCtx.getAttributeConsumingService());
-                }
-            }
-        }
-
-        log.debug("{} Initialized outbound message context", getLogPrefix());
-    }
-    
-}
\ No newline at end of file

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


More information about the commits mailing list