[java-opensaml COMMIT] /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttribute...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jun 18 11:24:49 EDT 2014
Author: scantor
Date: Wed Jun 18 11:24:49 2014
New Revision: 3932
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3932&view=rev
Log:
A few tweaks to simplify a bit and handle SAML 1 case.
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttributeConsumingServiceHandler.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttributeConsumingServiceHandler.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttributeConsumingServiceHandler.java?rev=3932&r1=3931&r2=3932&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttributeConsumingServiceHandler.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/impl/SAMLAddAttributeConsumingServiceHandler.java Wed Jun 18 11:24:49 2014
@@ -18,6 +18,7 @@
package org.opensaml.saml.common.binding.impl;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -25,29 +26,32 @@
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.messaging.handler.AbstractMessageHandler;
import org.opensaml.messaging.handler.MessageHandlerException;
-import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.common.messaging.context.AttributeConsumingServiceContext;
import org.opensaml.saml.common.messaging.context.SAMLMetadataContext;
import org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext;
-import org.opensaml.saml.common.messaging.context.SAMLProtocolContext;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.metadata.AttributeConsumingService;
import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Function;
import com.google.common.base.Functions;
/**
* SAML {@link org.opensaml.messaging.handler.MessageHandler} that attaches an {@link AttributeConsumingServiceContext}
- * to the {@link SAMLMetadataContext}.
+ * to the {@link SAMLMetadataContext} based on the content of an {@link AuthnRequest} in the message context.
*/
-public class SAMLAddAttributeConsumingServiceHandler extends AbstractMessageHandler<SAMLObject> {
+public class SAMLAddAttributeConsumingServiceHandler extends AbstractMessageHandler {
+
+ /** Logger. */
+ @Nonnull private final Logger log = LoggerFactory.getLogger(SAMLAddAttributeConsumingServiceHandler.class);
/** How to get the {@link SAMLMetadataContext} from the message. */
- @Nonnull private Function<MessageContext<SAMLObject>, SAMLMetadataContext> metadataContextStrategy;
-
- /** How to get the {@link SAMLProtocolContext} from the message. */
- @Nonnull private Function<MessageContext<SAMLObject>, SAMLProtocolContext> protocolContextStrategy;
+ @Nonnull private Function<MessageContext,SAMLMetadataContext> metadataContextStrategy;
+
+ /** Request to read from. */
+ @Nullable private AuthnRequest authnRequest;
/**
* Constructor.
@@ -55,11 +59,8 @@
public SAMLAddAttributeConsumingServiceHandler() {
metadataContextStrategy =
Functions.compose(
- new ChildContextLookup<SAMLPeerEntityContext, SAMLMetadataContext>(
- SAMLMetadataContext.class),
- new ChildContextLookup<MessageContext<SAMLObject>, SAMLPeerEntityContext>(
- SAMLPeerEntityContext.class));
- protocolContextStrategy = new ChildContextLookup<>(SAMLProtocolContext.class);
+ new ChildContextLookup<SAMLPeerEntityContext,SAMLMetadataContext>(SAMLMetadataContext.class),
+ new ChildContextLookup<MessageContext,SAMLPeerEntityContext>(SAMLPeerEntityContext.class));
}
/**
@@ -67,7 +68,7 @@
*
* @return Returns strategy.
*/
- public Function<MessageContext<SAMLObject>, SAMLMetadataContext> getMetadataContextStrategy() {
+ @Nonnull public Function<MessageContext,SAMLMetadataContext> getMetadataContextStrategy() {
return metadataContextStrategy;
}
@@ -76,44 +77,44 @@
*
* @param strategy what to set
*/
- public void setMetadataContextStrategy(@Nonnull Function<MessageContext<SAMLObject>,
- SAMLMetadataContext> strategy) {
- metadataContextStrategy = Constraint.isNotNull(strategy, "Metadata Strategy must not be null");
+ public void setMetadataContextStrategy(@Nonnull final Function<MessageContext,SAMLMetadataContext> strategy) {
+ metadataContextStrategy = Constraint.isNotNull(strategy, "Metadata Strategy cannot be null");
}
-
- /**
[... 82 lines stripped ...]
More information about the commits
mailing list