[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
Mon May 7 14:16:55 BST 2012


Author: lajoie
Date: Mon May  7 14:16:55 2012
New Revision: 4189

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4189&view=rev
Log:
add config flag that determines if generate authn/attribute statements are added to an existing assertion or always added to a new one
add config flag that determines if audiences are added to an existing audience restriction or placed in their own

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAttributeStatementToAssertion.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertions.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertion.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=4189&r1=4188&r2=4189&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 Mon May  7 14:16:55 2012
@@ -63,6 +63,9 @@
     /** Class logger. */
     private final Logger log = LoggerFactory.getLogger(AddAttributeStatementToAssertion.class);
 
+    /** Whether the generated attribute statement should be placed in its own assertion or added to one if it exists. */
+    private boolean statementInOwnAssertion;
+
     /**
      * Strategy used to locate the {@link RelyingPartyContext} associated with a given {@link ProfileRequestContext}.
      */
@@ -72,9 +75,34 @@
     public AddAttributeStatementToAssertion() {
         super();
 
+        statementInOwnAssertion = false;
+
         relyingPartyContextLookupStrategy =
-                new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class,
-                        false);
+                new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class, false);
+    }
+
+    /**
+     * Gets whether the generated attribute statement should be placed in its own assertion or added to one if it
+     * exists.
+     * 
+     * @return whether the generated attribute statement should be placed in its own assertion or added to one if it
+     *         exists
+     */
+    public boolean isStatementInOwnAssertion() {
+        return statementInOwnAssertion;
+    }
+
+    /**
+     * Sets whether the generated attribute statement should be placed in its own assertion or added to one if it
+     * exists.
+     * 
+     * @param inOwnAssertion whether the generated attribute statement should be placed in its own assertion or
+     *            added to one if it exists
+     */
+    public synchronized void setStatementInOwnAssertion(boolean inOwnAssertion) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        statementInOwnAssertion = inOwnAssertion;
     }
 
     /**
@@ -141,10 +169,9 @@
      * @return the assertion to which the attribute statement will be added
      */
     private Assertion getStatementAssertion(RelyingPartyContext relyingPartyContext, Response response) {
-        // TODO allow for a configuration option that forces the statement in to its own assertion
 
         final Assertion assertion;
-        if (response.getAssertions().isEmpty()) {
+        if (statementInOwnAssertion || response.getAssertions().isEmpty()) {
             assertion = Saml1ActionSupport.addAssertionToResponse(this, relyingPartyContext, response);
         } else {
             assertion = response.getAssertions().get(0);

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertions.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertions.java?rev=4189&r1=4188&r2=4189&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertions.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertions.java Mon May  7 14:16:55 2012
@@ -49,8 +49,6 @@
 
 import com.google.common.base.Function;
 
-//TODO have an option that controls, if a restriction condition already exists, if a new one is added or if the audiences are just added the existing condition
-
 /** Adds an {@link AudienceRestrictionCondition} to every {@link Assertion} contained on the {@link Response}. */
 public class AddAudienceRestrictionToAssertions extends AbstractProfileAction<Object, Response> {
 

[... 176 lines stripped ...]


More information about the commits mailing list