[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl: AssertionUnmarsh...

noreply at shibboleth.net noreply at shibboleth.net
Tue Nov 25 18:06:14 EST 2014


Author: scantor
Date: Tue Nov 25 18:06:14 2014
New Revision: 4169

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4169&view=rev
Log:
OSJ-95 -  SAML 1 assertion/message unmarshallers ignore MajorVersion

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionUnmarshaller.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionUnmarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionUnmarshaller.java?rev=4169&r1=4168&r2=4169&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionUnmarshaller.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionUnmarshaller.java Tue Nov 25 18:06:14 2014
@@ -79,10 +79,26 @@
         } else if (Assertion.ISSUEINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
                 && !Strings.isNullOrEmpty(attribute.getValue())) {
             assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
+        } else if (Assertion.MAJORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
+            int major;
+            try {
+                major = Integer.parseInt(attribute.getValue());
+                if (major != 1) {
+                    throw new UnmarshallingException("MajorVersion was invalid, must be 1");
+                }
+            } catch (final NumberFormatException n) {
+                throw new UnmarshallingException(n);
+            }
         } else if (Assertion.MINORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
-            if ("0".equals(attribute.getValue())) {
+            int minor;
+            try {
+                minor = Integer.parseInt(attribute.getValue());
+            } catch (NumberFormatException n) {
+                throw new UnmarshallingException(n);
+            }
+            if (minor == 0) {
                 assertion.setVersion(SAMLVersion.VERSION_10);
-            } else {
+            } else if (minor == 1) {
                 assertion.setVersion(SAMLVersion.VERSION_11);
             }
         } else {

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java?rev=4169&r1=4168&r2=4169&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java Tue Nov 25 18:06:14 2014
@@ -79,6 +79,17 @@
                 && !Strings.isNullOrEmpty(attribute.getValue())) {
             DateTime cal = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
             request.setIssueInstant(cal);
+        } else if (attribute.getLocalName().equals(RequestAbstractType.MAJORVERSION_ATTRIB_NAME)) {
+            int major;
+            try {
+                major = Integer.parseInt(attribute.getValue());
+                if (major != 1) {
+                    throw new UnmarshallingException("MajorVersion was invalid, must be 1");
+                }
+            } catch (final NumberFormatException n) {
+                log.error("Failed to parse major version string", n);
+                throw new UnmarshallingException(n);
+            }
         } else if (RequestAbstractType.MINORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
             int minor;
             try {

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java?rev=4169&r1=4168&r2=4169&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java Tue Nov 25 18:06:14 2014
@@ -78,12 +78,23 @@
         } else if (attribute.getLocalName().equals(ResponseAbstractType.ISSUEINSTANT_ATTRIB_NAME)
                 && !Strings.isNullOrEmpty(attribute.getValue())) {
             response.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));

[... 22 lines stripped ...]


More information about the commits mailing list