[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java ope...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Feb 3 18:29:34 EST 2017
Author: putmanb
Date: Fri Feb 3 18:29:33 2017
New Revision: 4605
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4605&view=rev
Log:
OSJ-190: SAML 2 Redirect binding decoder should handle SAMLEncoding parameter
Modified:
trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoderTest.java
Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java?rev=4605&r1=4604&r2=4605&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/xml/SAMLConstants.java Fri Feb 3 18:29:33 2017
@@ -320,6 +320,10 @@
/** SAML 2.0 Metadata Profile for Algorithm Support QName prefix. */
public static final String SAML20ALG_PREFIX = "alg";
+
+ /** URI for SAML 2 binding URL encoding DEFLATE method. */
+ public static final String SAML2_BINDING_URL_ENCODING_DEFLATE_URI =
+ "urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE";
/** Constructor. */
private SAMLConstants() {
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java?rev=4605&r1=4604&r2=4605&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java Fri Feb 3 18:29:33 2017
@@ -28,6 +28,7 @@
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.decoder.MessageDecodingException;
@@ -87,6 +88,11 @@
if (!"GET".equalsIgnoreCase(request.getMethod())) {
throw new MessageDecodingException("This message decoder only supports the HTTP GET method");
+ }
+
+ String samlEncoding = StringSupport.trimOrNull(request.getParameter("SAMLEncoding"));
+ if (samlEncoding != null && !SAMLConstants.SAML2_BINDING_URL_ENCODING_DEFLATE_URI.equals(samlEncoding)) {
+ throw new MessageDecodingException("Request indicated an unsupported SAMLEncoding: " + samlEncoding);
}
String relayState = request.getParameter("RelayState");
Modified: trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoderTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoderTest.java?rev=4605&r1=4604&r2=4605&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoderTest.java (original)
+++ trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoderTest.java Fri Feb 3 18:29:33 2017
@@ -24,9 +24,6 @@
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
-import net.shibboleth.utilities.java.support.codec.Base64Support;
-import net.shibboleth.utilities.java.support.xml.SerializeSupport;
-
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.MarshallingException;
import org.opensaml.messaging.context.MessageContext;
@@ -34,7 +31,6 @@
import org.opensaml.messaging.encoder.MessageEncodingException;
import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.common.binding.SAMLBindingSupport;
-import org.opensaml.saml.saml2.binding.decoding.impl.HTTPRedirectDeflateDecoder;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.core.RequestAbstractType;
import org.opensaml.saml.saml2.core.Response;
@@ -42,6 +38,9 @@
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+
+import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.xml.SerializeSupport;
/**
*
@@ -98,6 +97,36 @@
[... 37 lines stripped ...]
More information about the commits
mailing list