[java-plugin-shibd-saml] branch main updated: Migrate to OpenSAML ECP message classes.

Codeberg noreply at shibboleth.net
Tue Nov 17 20:13:50 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/2bc6178c49ca47220eb7c802244d5ae1de279a17

The following commit(s) were added to refs/heads/main by this push:
     new 2bc6178  Migrate to OpenSAML ECP message classes.
2bc6178 is described below

commit 2bc6178c49ca47220eb7c802244d5ae1de279a17
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Nov 17 15:13:26 2026 -0500

    Migrate to OpenSAML ECP message classes.
---
 .../saml2/profile/SAML2InitiatorConstants.java     |   3 -
 .../idp/flows/sp/consumer/saml2/ecp/ecp-beans.xml  |   2 +-
 .../shibboleth/idp/flows/sp/saml2-common-beans.xml |   2 +-
 .../binding/decoding/impl/HTTPECPDecoder.java      | 165 ---------------------
 .../saml2/binding/decoding/impl/package-info.java  |  18 ---
 .../binding/encoding/impl/HTTPPAOSEncoder.java     |  42 ------
 .../saml2/binding/encoding/impl/package-info.java  |  18 ---
 .../impl/ECPHttpServletRequestValidator.java       |   2 +-
 8 files changed, 3 insertions(+), 249 deletions(-)

diff --git a/sp-saml-api/src/main/java/net/shibboleth/sp/saml/saml2/profile/SAML2InitiatorConstants.java b/sp-saml-api/src/main/java/net/shibboleth/sp/saml/saml2/profile/SAML2InitiatorConstants.java
index 456d781..b29cabc 100644
--- a/sp-saml-api/src/main/java/net/shibboleth/sp/saml/saml2/profile/SAML2InitiatorConstants.java
+++ b/sp-saml-api/src/main/java/net/shibboleth/sp/saml/saml2/profile/SAML2InitiatorConstants.java
@@ -53,9 +53,6 @@ public final class SAML2InitiatorConstants {
 
     /** SPNameQualifier input parameter. */
     @Nonnull @NotEmpty public static final String SP_NAME_QUALIFIER = NameIDPolicy.SP_NAME_QUALIFIER_ATTRIB_NAME;
-
-    /** PAOS media type for ECP client requests. */
-    @Nonnull @NotEmpty public static final String PAOS_MEDIA_TYPE = "application/vnd.paos+xml";
     
     /** Required start of PAOS header during ECP client requests. */
     @Nonnull @NotEmpty public static final String PAOS_HEADER_VERSION_INDICATOR = "ver=\"urn:liberty:paos:2003-08\";";
diff --git a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/ecp/ecp-beans.xml b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/ecp/ecp-beans.xml
index 1df3828..7b9ef43 100644
--- a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/ecp/ecp-beans.xml
+++ b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/saml2/ecp/ecp-beans.xml
@@ -20,7 +20,7 @@
     <bean id="DecodeMessage" class="net.shibboleth.sp.profile.impl.DecodeMessage" scope="prototype"
             p:messageType="org.opensaml.saml.saml2.core.Response">
         <constructor-arg>
-            <bean class="net.shibboleth.sp.saml.saml2.binding.decoding.impl.HTTPECPDecoder" scope="prototype"
+            <bean class="org.opensaml.saml.saml2.binding.decoding.impl.HTTPECPDecoder" scope="prototype"
                 p:checkDuringInit="false"
                 p:parserPool-ref="shibboleth.ParserPool"
                 p:httpServletRequestSupplier-ref="shibboleth.RemotedHttpServletRequestSupplier"
diff --git a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/saml2-common-beans.xml b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/saml2-common-beans.xml
index 32130e6..035eaa9 100644
--- a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/saml2-common-beans.xml
+++ b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/saml2-common-beans.xml
@@ -242,7 +242,7 @@
     <!-- Add PAOS binding material for ECP. -->
 
     <bean id="shibboleth.Encoders.SAML2PAOSEncoder"
-          class="net.shibboleth.sp.saml.saml2.binding.encoding.impl.HTTPPAOSEncoder" scope="prototype" init-method=""
+          class="org.opensaml.saml.saml2.binding.encoding.impl.HTTPPAOSEncoder" scope="prototype" init-method=""
           p:httpServletResponseSupplier-ref="shibboleth.RemotedHttpServletResponseSupplier" />
 
     <bean parent="shibboleth.BindingDescriptor" id="shibboleth.Binding.SAML2PAOS"
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/HTTPECPDecoder.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/HTTPECPDecoder.java
deleted file mode 100644
index 47eb00f..0000000
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/HTTPECPDecoder.java
+++ /dev/null
@@ -1,165 +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.binding.decoding.impl;
-
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.core.xml.XMLObject;
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.decoder.MessageDecodingException;
-import org.opensaml.messaging.handler.MessageHandler;
-import org.opensaml.saml.common.SAMLObject;
-import org.opensaml.saml.common.binding.BindingDescriptor;
-import org.opensaml.saml.common.binding.SAMLBindingSupport;
-import org.opensaml.saml.common.binding.decoding.SAMLMessageDecoder;
-import org.opensaml.saml.common.binding.impl.SAMLSOAPDecoderBodyHandler;
-import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
-import org.opensaml.saml.common.xml.SAMLConstants;
-import org.opensaml.saml.saml2.ecp.RelayState;
-import org.opensaml.soap.messaging.context.SOAP11Context;
-import org.opensaml.soap.soap11.Envelope;
-import org.opensaml.soap.soap11.Header;
-import org.slf4j.Logger;
-
-import jakarta.servlet.http.HttpServletRequest;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.sp.saml.saml2.profile.SAML2InitiatorConstants;
-
-/**
- * SAML 2.0 ECP/PAOS Decoder.
- */
-public class HTTPECPDecoder extends org.opensaml.soap.soap11.decoder.http.impl.HTTPSOAP11Decoder 
-        implements SAMLMessageDecoder {
-
-    /** Class logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(HTTPECPDecoder.class);
-    
-    /** Optional {@link BindingDescriptor} to inject into {@link SAMLBindingContext} created. */
-    @Nullable private BindingDescriptor bindingDescriptor;
-    
-    /** Constructor. */
-    public HTTPECPDecoder() {
-        setProtocolMessageLoggerSubCategory("SAML");
-    }
-
-    /** {@inheritDoc} */
-    @Nonnull @NotEmpty public String getBindingURI() {
-        return SAMLConstants.SAML2_PAOS_BINDING_URI;
-    }
-
-    /**
-     * Get an optional {@link BindingDescriptor} to inject into {@link SAMLBindingContext} created.
-     * 
-     * @return binding descriptor
-     */
-    @Nullable public BindingDescriptor getBindingDescriptor() {
-        return bindingDescriptor;
-    }
-    
-    /**
-     * Set an optional {@link BindingDescriptor} to inject into {@link SAMLBindingContext} created.
-     * 
-     * @param descriptor a binding descriptor
-     */
-    public void setBindingDescriptor(@Nullable final BindingDescriptor descriptor) {
-        bindingDescriptor = descriptor;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void doInitialize() throws ComponentInitializationException {
-        
-        // Need to set this before calling base class.
-        if (getBodyHandler() == null) {
-            final MessageHandler handler = new SAMLSOAPDecoderBodyHandler();
-            handler.initialize();
-            setBodyHandler(handler);
-        }
-        
-        super.doInitialize();
-    }
-    
-    /** {@inheritDoc} */
-    protected void doDecode() throws MessageDecodingException {
-        super.doDecode();
-        
-        final MessageContext msgCtx = getMessageContext();
-        assert msgCtx != null;
-        
-        populateBindingContext(msgCtx);
-        
-        processSOAPHeaders(msgCtx);
-        
-        final Object samlMessage = msgCtx.getMessage();
-        if (samlMessage instanceof SAMLObject) {
-            log.debug("Decoded SOAP message which included SAML message of type {}",
-                    ((SAMLObject) samlMessage).getElementQName());
-        } else {
-            throw new MessageDecodingException("Decoded SOAP message did not contain SAMLObject");
-        }
-    }
-    
-    /**
-     * Populate the context which carries information specific to this binding.
-     * 
-     * @param messageContext the current message context
-     */
-    protected void populateBindingContext(@Nonnull final MessageContext messageContext) {
-        final SAMLBindingContext bindingContext = messageContext.ensureSubcontext(SAMLBindingContext.class);
-        bindingContext.setBindingUri(getBindingURI());
-        bindingContext.setBindingDescriptor(bindingDescriptor);
-        bindingContext.setHasBindingSignature(false);
-        bindingContext.setIntendedDestinationEndpointURIRequired(true);
-    }
-    
-    /**
-     * Process ECP/PAOS headers.
-     * 
-     * @param messageContext message context
-     */
-    protected void processSOAPHeaders(@Nonnull final MessageContext messageContext) {
-        final SOAP11Context soapContext = messageContext.ensureSubcontext(SOAP11Context.class);
-        final Envelope env = soapContext.getEnvelope();
-        final Header header = env != null ? env.getHeader() : null;
-        if (header != null) {
-            final List<XMLObject> relayState = header.getUnknownXMLObjects(RelayState.DEFAULT_ELEMENT_NAME);
-            if (relayState != null && relayState.size() > 0) {
-                SAMLBindingSupport.setRelayState(messageContext, ((RelayState) relayState.get(0)).getValue());
-            }
-            
-            // We're ignoring the PAOS Response header if it exists, as the correlation at the SAML layer is
-            // applied later.
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void validateHttpRequest(@Nonnull final HttpServletRequest request) throws MessageDecodingException {
-        
-        // Replace usual SOAP type check.
-        if (!SAML2InitiatorConstants.PAOS_MEDIA_TYPE.equals(request.getContentType())) {
-            log.warn("Saw unsupported request Content-Type: {}", request.getContentType());
-            throw new MessageDecodingException(
-                    String.format("Content-Type '%s' was not a supported media type", request.getContentType()));
-        }
- 
-    }
-    
-}
\ No newline at end of file
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/package-info.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/package-info.java
deleted file mode 100644
index 2e973d5..0000000
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/decoding/impl/package-info.java
+++ /dev/null
@@ -1,18 +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.
- */
-
-/**
- * SAML 2.0 MessageDecoders specific to the SP.
- */
-package net.shibboleth.sp.saml.saml2.binding.decoding.impl;
\ No newline at end of file
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/HTTPPAOSEncoder.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/HTTPPAOSEncoder.java
deleted file mode 100644
index 6d676e3..0000000
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/HTTPPAOSEncoder.java
+++ /dev/null
@@ -1,42 +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.binding.encoding.impl;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.saml.common.binding.encoding.SAMLMessageEncoder;
-import org.opensaml.saml.common.xml.SAMLConstants;
-import org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-
-/**
- * SAML 2.0 PAOS Encoder.
- */
-public class HTTPPAOSEncoder extends HTTPSOAP11Encoder
-        implements SAMLMessageEncoder {
-
-    /** Constructor. */
-    public HTTPPAOSEncoder() {
-        setProtocolMessageLoggerSubCategory("SAML");
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    @Nonnull @NotEmpty public String getBindingURI() {
-        return SAMLConstants.SAML2_PAOS_BINDING_URI;
-    }
-        
-}
\ No newline at end of file
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/package-info.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/package-info.java
deleted file mode 100644
index 1881006..0000000
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/encoding/impl/package-info.java
+++ /dev/null
@@ -1,18 +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.
- */
-
-/**
- * SAML 2.0 MessageEncoders specific to the SP.
- */
-package net.shibboleth.sp.saml.saml2.binding.encoding.impl;
\ No newline at end of file
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/impl/ECPHttpServletRequestValidator.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/impl/ECPHttpServletRequestValidator.java
index e172f88..0f36e71 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/impl/ECPHttpServletRequestValidator.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/binding/impl/ECPHttpServletRequestValidator.java
@@ -48,7 +48,7 @@ public class ECPHttpServletRequestValidator implements HttpServletRequestValidat
     /** Constructor. */
     @SuppressWarnings("null")
     public ECPHttpServletRequestValidator() {
-        paosType = MediaType.parseMediaType(SAML2InitiatorConstants.PAOS_MEDIA_TYPE);
+        paosType = MediaType.parseMediaType(SAMLConstants.PAOS_MEDIA_TYPE);
     }
     
     /** {@inheritDoc} */

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


More information about the commits mailing list