Class SAMLMetadataLookupHandler
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,MessageHandler
SAMLMetadataContext
child of a
pre-existing concrete instance of AbstractSAMLEntityContext
.
The entity context class is configurable and defaults to SAMLPeerEntityContext
.
The handler will no-op in the absence of an existing AbstractSAMLEntityContext
child of the message context with non-null values for both entityID and role.
If the optional copy strategy is configured via setCopyContextStrategy(Function)
,
and if that lookup finds an existing metadata context with compatible data (matching entityID and role),
then its data will be re-used.
Otherwise an attempt to resolve metadata will be performed with the configured RoleDescriptorResolver
.
A protocol from a SAMLProtocolContext
will be added to the lookup, if available.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<MessageContext,
SAMLMetadataContext> Optional strategy for resolving an existing metadata context from which to copy data.private Class<? extends AbstractSAMLEntityContext>
The context class representing the SAML entity whose data is to be resolved.private final org.slf4j.Logger
Logger.private RoleDescriptorResolver
Resolver used to look up SAML metadata. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CriteriaSet
buildLookupCriteria
(MessageContext messageContext) Build the lookup criteria from the message context data.protected void
protected void
doInvoke
(MessageContext messageContext) Performs the handler logic.protected SAMLMetadataContext
resolveExisting
(MessageContext messageContext, String entityID, QName role) Attempt to resolve an existingSAMLMetadataContext
from which to copy.void
Set the optional strategy for resolving an existing metadata context from which to copy data.void
setEntityContextClass
(Class<? extends AbstractSAMLEntityContext> clazz) Set the class type holding the SAML entity data.void
Set theRoleDescriptorResolver
to use.Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler
doPostInvoke, doPostInvoke, doPreInvoke, getActivationCondition, getLogPrefix, invoke, setActivationCondition
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, 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. -
metadataResolver
Resolver used to look up SAML metadata. -
entityContextClass
The context class representing the SAML entity whose data is to be resolved. Defaults to:SAMLPeerEntityContext
. -
copyContextStrategy
Optional strategy for resolving an existing metadata context from which to copy data.
-
-
Constructor Details
-
SAMLMetadataLookupHandler
public SAMLMetadataLookupHandler()
-
-
Method Details
-
setCopyContextStrategy
Set the optional strategy for resolving an existing metadata context from which to copy data.- Parameters:
strategy
- the strategy function
-
setEntityContextClass
Set the class type holding the SAML entity data.Defaults to:
SAMLPeerEntityContext
.- Parameters:
clazz
- the entity context class type
-
setRoleDescriptorResolver
Set theRoleDescriptorResolver
to use.- Parameters:
resolver
- the resolver to use
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
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
-
buildLookupCriteria
Build the lookup criteria from the message context data.- Parameters:
messageContext
- the current message context- Returns:
- the new lookup criteria
-
resolveExisting
@Nullable protected SAMLMetadataContext resolveExisting(@Nonnull MessageContext messageContext, @Nonnull String entityID, @Nonnull QName role) Attempt to resolve an existingSAMLMetadataContext
from which to copy.The returned context will always be a fresh parent-less instance, suitable for the caller to directly store in the current message context.
- Parameters:
messageContext
- the current message contextentityID
- the entityID against which to matchrole
- the entity role against which to match- Returns:
- a new instance of
SAMLMetadataContext
, or null if one can not be resolved
-