[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/common/profile/impl/PopulateBind...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Feb 17 21:46:15 EST 2014
Author: scantor
Date: Mon Feb 17 21:46:15 2014
New Revision: 3628
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3628&view=rev
Log:
OSJ-63 - unit tests and bug fixes
Added:
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/profile/
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/profile/impl/
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContextsTest.java (with props)
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContexts.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContexts.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContexts.java?rev=3628&r1=3627&r2=3628&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContexts.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/PopulateBindingAndEndpointContexts.java Mon Feb 17 21:46:15 2014
@@ -34,12 +34,13 @@
import org.opensaml.core.xml.XMLObjectBuilder;
import org.opensaml.core.xml.util.XMLObjectSupport;
-import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.ProfileException;
import org.opensaml.profile.action.AbstractProfileAction;
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 org.opensaml.saml.common.binding.BindingDescriptor;
import org.opensaml.saml.common.binding.DefaultEndpointResolver;
import org.opensaml.saml.common.binding.EndpointResolver;
@@ -59,6 +60,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
@@ -96,6 +99,15 @@
/** List of possible bindings, in preference order. */
@Nonnull @NonnullElements private List<BindingDescriptor> bindingDescriptors;
+ /** Strategy function for access to {@link SAMLMetadataContext} for input to resolver. */
+ @Nonnull private Function<ProfileRequestContext,SAMLMetadataContext> metadataContextLookupStrategy;
+
+ /** Strategy function for access to {@link SAMLBindingContext} to populate. */
+ @Nonnull private Function<ProfileRequestContext,SAMLBindingContext> bindingContextLookupStrategy;
+
+ /** Strategy function for access to {@link SAMLEndpointContext} to populate. */
+ @Nonnull private Function<ProfileRequestContext,SAMLEndpointContext> endpointContextLookupStrategy;
+
/** Builder for template endpoints. */
@NonnullAfterInit private XMLObjectBuilder<?> endpointBuilder;
@@ -110,6 +122,22 @@
endpointType = AssertionConsumerService.DEFAULT_ELEMENT_NAME;
endpointResolver = new DefaultEndpointResolver();
bindingDescriptors = Collections.emptyList();
+
+ // Default: outbound msg context -> SAMLPeerEntityContext -> SAMLMetadataContext
+ metadataContextLookupStrategy = Functions.compose(
+ new ChildContextLookup<>(SAMLMetadataContext.class),
+ Functions.compose(new ChildContextLookup<>(SAMLPeerEntityContext.class),
+ new OutboundMessageContextLookup()));
+
+ // Default: outbound msg context -> SAMLBindingContext
+ bindingContextLookupStrategy = Functions.compose(
+ new ChildContextLookup<>(SAMLBindingContext.class, true), new OutboundMessageContextLookup());
+
+ // Default: outbound msg context -> SAMLPeerEntityContext -> SAMLEndpointContext
+ endpointContextLookupStrategy = Functions.compose(
+ new ChildContextLookup<>(SAMLEndpointContext.class, true),
+ Functions.compose(new ChildContextLookup<>(SAMLPeerEntityContext.class, true),
+ new OutboundMessageContextLookup()));
}
/**
@@ -146,9 +174,44 @@
bindingDescriptors = Lists.newArrayList(Collections2.filter(bindings, Predicates.notNull()));
}
+ /**
+ * Set lookup strategy for {@link SAMLMetadataContext} for input to resolution.
+ *
+ * @param strategy lookup strategy
+ */
+ public void setMetadataContextLookupStrategy(
+ @Nonnull final Function<ProfileRequestContext,SAMLMetadataContext> strategy) {
+ metadataContextLookupStrategy = Constraint.isNotNull(strategy,
+ "SAMLMetadataContext lookup strategy cannot be null");
+ }
+
+ /**
[... 106 lines stripped ...]
More information about the commits
mailing list