[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/saml1/Add...

noreply at shibboleth.net noreply at shibboleth.net
Thu Nov 8 21:56:52 EST 2012


Author: tzeller
Date: Thu Nov  8 21:56:51 2012
New Revision: 4233

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4233&view=rev
Log:
Updated test to complete IDP-119.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertionTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java?rev=4233&r1=4232&r2=4233&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java Thu Nov  8 21:56:51 2012
@@ -69,7 +69,9 @@
         @Event(id = EventIds.INVALID_ATTRIBUTE_CTX,
                 description = "Returned if no attribute context is associated with the relying party context"),
         @Event(id = SamlEventIds.UNABLE_ENCODE_ATTRIBUTE,
-                description = "Returned if there was a problem encoding an attribute")})
+                description = "Returned if there was a problem encoding an attribute"),
+        @Event(id = SamlEventIds.NO_RESPONSE,
+                description = "No SAML response object is associated with the current request")})
 public class AddAttributeStatementToAssertion extends AbstractProfileAction<Object, Response> {
 
     /** Class logger. */
@@ -121,6 +123,30 @@
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
 
         statementInOwnAssertion = inOwnAssertion;
+    }
+
+    /**
+     * Gets whether the attributes that result in an {@link AttributeEncodingException} when being encoded should be
+     * ignored or result in an {@link #UNABLE_ENCODE_ATTRIBUTE} transition.
+     * 
+     * @return whether the attributes that result in an {@link AttributeEncodingException} when being encoded should be
+     *         ignored or result in an {@link #UNABLE_ENCODE_ATTRIBUTE} transition
+     */
+    public boolean isIgnoringUnencodableAttributes() {
+        return ignoringUnencodableAttributes;
+    }
+
+    /**
+     * Sets whether the attributes that result in an {@link AttributeEncodingException} when being encoded should be
+     * ignored or result in an {@link #UNABLE_ENCODE_ATTRIBUTE} transition.
+     * 
+     * @param ignoreUnencodableAttributes whether the attributes that result in an {@link AttributeEncodingException}
+     *            when being encoded should be ignored or result in an {@link #UNABLE_ENCODE_ATTRIBUTE} transition
+     */
+    public void setIgnoringUnencodableAttributes(boolean ignoreUnencodableAttributes) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        ignoringUnencodableAttributes = ignoreUnencodableAttributes;
     }
 
     /**
@@ -166,6 +192,12 @@
             log.debug("Action {}: No AttributeSubcontext available for relying party  {}, nothing left to do", getId(),
                     relyingPartyCtx.getRelyingPartyId());
             return ActionSupport.buildEvent(this, EventIds.INVALID_ATTRIBUTE_CTX);
+        }
+
+        final Response response = profileRequestContext.getOutboundMessageContext().getMessage();
+        if (response == null) {
+            log.error("Action {}: No SAML response located in current profile request context", getId());
+            return ActionSupport.buildEvent(this, SamlEventIds.NO_RESPONSE);
         }
 
         try {
@@ -175,9 +207,7 @@
                 return ActionSupport.buildProceedEvent(this);
             }
 
-            final Assertion assertion =
-                    getStatementAssertion(relyingPartyCtx, profileRequestContext.getOutboundMessageContext()
-                            .getMessage());
+            final Assertion assertion = getStatementAssertion(relyingPartyCtx, response);
             assertion.getAttributeStatements().add(statement);
 
             log.debug("Action {}: Adding constructed AttributeStatement to Assertion {} ", getId(), assertion.getID());

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertionTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertionTest.java?rev=4233&r1=4232&r2=4233&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertionTest.java (original)

[... 449 lines stripped ...]


More information about the commits mailing list