Class SAMLAddAttributeConsumingServiceHandler
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
org.opensaml.saml.common.binding.impl.SAMLAddAttributeConsumingServiceHandler
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,MessageHandler
SAML
MessageHandler
that attaches an AttributeConsumingServiceContext
to the SAMLMetadataContext
based on the content of an AuthnRequest
in the message context.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Default lookup function that find a SAML 2AuthnRequest
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<MessageContext,
AuthnRequest> Lookup strategy for anAuthnRequest
index.private Integer
AttributeConsumingService
index - if specified.private final org.slf4j.Logger
Logger.private Function<MessageContext,
SAMLMetadataContext> Lookup strategy forSAMLMetadataContext
.private List<RequestedAttribute>
RequestedAttribute
list - if specified. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate AttributeConsumingService
Generate anAttributeConsumingService
from theRequestedAttributes
.protected void
doInvoke
(MessageContext messageContext) Performs the handler logic.protected boolean
doPreInvoke
(MessageContext messageContext) Called prior to execution, handlers may override this method to perform pre-processing for a request.private List<RequestedAttribute>
Grab theRequestedAttribute
(if any) from theAuthnRequest
.void
setIndexLookupStrategy
(Function<MessageContext, AuthnRequest> strategy) Set the strategy to locate theAttributeConsumingService
index from theMessageContext
.void
Set the strategy to locate theSAMLMetadataContext
from theMessageContext
.Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler
doPostInvoke, doPostInvoke, getActivationCondition, getLogPrefix, invoke, setActivationCondition
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logLogger. -
metadataContextLookupStrategy
Lookup strategy forSAMLMetadataContext
. -
authnRequestLookupStrategy
Lookup strategy for anAuthnRequest
index. -
index
AttributeConsumingService
index - if specified. -
requestedAttributes
RequestedAttribute
list - if specified.
-
-
Constructor Details
-
SAMLAddAttributeConsumingServiceHandler
public SAMLAddAttributeConsumingServiceHandler()Constructor.
-
-
Method Details
-
setMetadataContextLookupStrategy
public void setMetadataContextLookupStrategy(@Nonnull Function<MessageContext, SAMLMetadataContext> strategy) Set the strategy to locate theSAMLMetadataContext
from theMessageContext
.- Parameters:
strategy
- lookup strategy
-
setIndexLookupStrategy
Set the strategy to locate theAttributeConsumingService
index from theMessageContext
.- Parameters:
strategy
- lookup strategy
-
doPreInvoke
protected boolean doPreInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException Called prior to execution, handlers may override this method to perform pre-processing for a request.The default impl applies the
Predicate
set via theAbstractMessageHandler.setActivationCondition(Predicate)
.If false is returned, execution will not proceed.
Subclasses which override this method should generally invoke the super version of this method first, so that the activation condition will be applied up front, and immediately return false if the super version returns false. This avoids unnecessary execution of the remaining pre-invocation code if the handler ultimately will not execute.
- Overrides:
doPreInvoke
in classAbstractMessageHandler
- Parameters:
messageContext
- the message context on which to invoke the handler- Returns:
- true iff execution should proceed
- Throws:
MessageHandlerException
- if there is a problem executing the handler pre-routine
-
doInvoke
Performs the handler logic.- Specified by:
doInvoke
in classAbstractMessageHandler
- Parameters:
messageContext
- the message context on which to invoke the handler- Throws:
MessageHandlerException
- if there is an error invoking the handler on the message context
-
attributeConsumingServiceFromRequestedAttributes
private AttributeConsumingService attributeConsumingServiceFromRequestedAttributes() throws MessageHandlerExceptionGenerate anAttributeConsumingService
from theRequestedAttributes
.- Returns:
- a suitable AttributeConsumingService
- Throws:
MessageHandlerException
- when the cloning failed
-
getRequestedAttributes
Grab theRequestedAttribute
(if any) from theAuthnRequest
.- Parameters:
authn
- the request to interrogate- Returns:
- null or the list.
-