[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml: common/profile/impl/AddInRespons...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Mar 10 15:41:29 EDT 2014
Author: scantor
Date: Mon Mar 10 15:41:29 2014
New Revision: 3686
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3686&view=rev
Log:
Fix InResponseTo handling by suppressing for specific bindings, and honoring that downstream in subject conf.
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/AddInResponseToToResponse.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddSubjectConfirmationToSubjects.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/AddInResponseToToResponse.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/AddInResponseToToResponse.java?rev=3686&r1=3685&r2=3686&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/AddInResponseToToResponse.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/AddInResponseToToResponse.java Mon Mar 10 15:41:29 2014
@@ -17,6 +17,10 @@
package org.opensaml.saml.common.profile.impl;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -27,14 +31,16 @@
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.context.navigate.MessageLookup;
import org.opensaml.saml.common.SAMLObject;
+import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
import org.opensaml.saml.common.messaging.context.SAMLMessageInfoContext;
-import org.opensaml.saml.saml1.core.Response;
import org.opensaml.saml.saml1.core.ResponseAbstractType;
import org.opensaml.saml.saml2.core.StatusResponseType;
import org.slf4j.Logger;
@@ -42,6 +48,7 @@
import com.google.common.base.Function;
import com.google.common.base.Functions;
+import com.google.common.collect.Sets;
/**
* Action that adds the <code>InResponseTo</code> attribute to a response message if a SAML message ID is set on
@@ -58,7 +65,10 @@
@Nonnull private final Logger log = LoggerFactory.getLogger(AddInResponseToToResponse.class);
/** Strategy used to locate the message to operate on. */
- @Nonnull private Function<ProfileRequestContext, SAMLObject> responseLookupStrategy;
+ @Nonnull private Function<ProfileRequestContext,SAMLObject> responseLookupStrategy;
+
+ /** Strategy used to locate request ID to correlate. */
+ @Nonnull private Function<ProfileRequestContext,String> requestIdLookupStrategy;
/** Message to modify. */
@Nullable private SAMLObject response;
@@ -70,6 +80,7 @@
public AddInResponseToToResponse() {
responseLookupStrategy =
Functions.compose(new MessageLookup<>(SAMLObject.class), new OutboundMessageContextLookup());
+ requestIdLookupStrategy = new DefaultRequestIdLookupStrategy();
}
/**
@@ -78,10 +89,22 @@
* @param strategy strategy used to locate the message to operate on
*/
public synchronized void setResponseLookupStrategy(
- @Nonnull final Function<ProfileRequestContext, SAMLObject> strategy) {
+ @Nonnull final Function<ProfileRequestContext,SAMLObject> strategy) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
responseLookupStrategy = Constraint.isNotNull(strategy, "Response lookup strategy cannot be null");
+ }
+
+ /**
+ * Set the strategy used to locate the request ID.
+ *
+ * @param strategy lookup strategy
+ */
+ public synchronized void setRequestIdLookupStrategy(
+ @Nonnull final Function<ProfileRequestContext,String> strategy) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ requestIdLookupStrategy = Constraint.isNotNull(strategy, "Request ID lookup strategy cannot be null");
}
/** {@inheritDoc} */
@@ -89,19 +112,19 @@
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) throws ProfileException {
log.debug("{} Attempting to add InResponseTo to outgoing Response", getLogPrefix());
- requestId = getInboundMessageId(profileRequestContext);
- if (requestId == null) {
- log.debug("{} Inbound message did not have an ID, nothing to do", getLogPrefix());
- return false;
- }
-
response = responseLookupStrategy.apply(profileRequestContext);
if (response == null) {
[... 141 lines stripped ...]
More information about the commits
mailing list