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

noreply at shibboleth.net noreply at shibboleth.net
Sun Sep 28 17:55:53 EDT 2014


Author: scantor
Date: Sun Sep 28 17:55:53 2014
New Revision: 4088

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4088&view=rev
Log:
Enhance NameID actions to handle bare assertions.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddNameIDToSubjects.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java?rev=4088&r1=4087&r2=4088&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java Sun Sep 28 17:55:53 2014
@@ -27,7 +27,6 @@
 import org.opensaml.profile.action.ActionSupport;
 import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -36,7 +35,6 @@
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
-import org.opensaml.messaging.context.navigate.MessageLookup;
 import org.opensaml.saml.common.SAMLException;
 import org.opensaml.saml.common.SAMLObjectBuilder;
 import org.opensaml.saml.common.profile.logic.MetadataNameIdentifierFormatStrategy;
@@ -51,12 +49,10 @@
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Function;
-import com.google.common.base.Functions;
 
 /**
  * Action that builds a {@link NameIdentifier} and adds it to the {@link Subject} of all the statements
- * in all the assertions found in a {@link Response}. The message to update is returned by a lookup
- * strategy, by default the message returned by {@link ProfileRequestContext#getOutboundMessageContext()}.
+ * in all the assertions found via a lookup strategy, by default from the outbound message context.
  * 
  * <p>No assertions or statements will be created by this action, but if no {@link Subject} exists in
  * the statements found, it will be created.</p>
@@ -82,8 +78,8 @@
     /** Flag controlling whether to overwrite an existing NameIdentifier. */
     private boolean overwriteExisting;
     
-    /** Strategy used to locate the {@link Response} to operate on. */
-    @Nonnull private Function<ProfileRequestContext,Response> responseLookupStrategy;
+    /** Strategy used to locate the {@link Assertion}s to operate on. */
+    @Nonnull private Function<ProfileRequestContext,List<Assertion>> assertionsLookupStrategy;
 
     /** Strategy used to determine the formats to try. */
     @Nonnull private Function<ProfileRequestContext,List<String>> formatLookupStrategy;
@@ -94,8 +90,8 @@
     /** Formats to try. */
     @Nonnull @NonnullElements private List<String> formats;
     
-    /** Response to modify. */
-    @Nullable private Response response;
+    /** Assertions to modify. */
+    @Nonnull @NonnullElements private List<Assertion> assertions;
     
     /** Constructor. */
     public AddNameIdentifierToSubjects() {
@@ -108,8 +104,7 @@
         
         overwriteExisting = true;
         
-        responseLookupStrategy =
-                Functions.compose(new MessageLookup<>(Response.class), new OutboundMessageContextLookup());
+        assertionsLookupStrategy = new AssertionStrategy();
         formatLookupStrategy = new MetadataNameIdentifierFormatStrategy();
         formats = Collections.emptyList();
     }
@@ -126,14 +121,14 @@
     }
     
     /**
-     * Set the strategy used to locate the {@link Response} to operate on.
-     * 
-     * @param strategy strategy used to locate the {@link Response} to operate on
-     */
-    public void setResponseLookupStrategy(@Nonnull final Function<ProfileRequestContext,Response> strategy) {
+     * Set the strategy used to locate the {@link Assertion}s to operate on.
+     * 
+     * @param strategy lookup strategy
+     */
+    public void setAssertionsLookupStrategy(@Nonnull final Function<ProfileRequestContext,List<Assertion>> strategy) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
 
-        responseLookupStrategy = Constraint.isNotNull(strategy, "Response lookup strategy cannot be null");
+        assertionsLookupStrategy = Constraint.isNotNull(strategy, "Assertions lookup strategy cannot be null");
     }
 
     /**
@@ -171,15 +166,20 @@
     /** {@inheritDoc} */
     @Override
     protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {

[... 208 lines stripped ...]


More information about the commits mailing list