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.LoggerLogger.private RoleDescriptorResolverResolver used to look up SAML metadata.private Function<MessageContext,ProfileRequestContext> Optional but defaulted strategy for locating a PRC. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CriteriaSetbuildLookupCriteria(MessageContext messageContext, String entityID, QName role) Build the lookup criteria from the message context data.protected voidprotected voiddoInvoke(MessageContext messageContext) Performs the handler logic.protected SAMLMetadataContextresolveExisting(MessageContext messageContext, String entityID, QName role) Attempt to resolve an existingSAMLMetadataContextfrom which to copy.voidSet the optional strategy for resolving an existing metadata context from which to copy data.voidsetEntityContextClass(Class<? extends AbstractSAMLEntityContext> clazz) Set the class type holding the SAML entity data.voidSet optional lookup strategy for locatingProfileRequestContext.voidSet theRoleDescriptorResolverto use.Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler
doPostInvoke, doPostInvoke, doPreInvoke, getActivationCondition, getLogPrefix, invoke, isPreInvokeCalled, setActivationConditionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.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. -
profileRequestContextLookupStrategy
@Nullable private Function<MessageContext,ProfileRequestContext> profileRequestContextLookupStrategyOptional but defaulted strategy for locating a PRC.
-
-
Constructor Details
-
SAMLMetadataLookupHandler
public SAMLMetadataLookupHandler()Constructor.
-
-
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 theRoleDescriptorResolverto use.- Parameters:
resolver- the resolver to use
-
setProfileRequestContextLookupStrategy
public void setProfileRequestContextLookupStrategy(@Nullable Function<MessageContext, ProfileRequestContext> strategy) Set optional lookup strategy for locatingProfileRequestContext.Defaults to parent lookup. If set and found, a
ProfileRequestContextCriterionwill be included in the attempt.- Parameters:
strategy- the lookup strategy- Since:
- 5.0.0
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doInvoke
Performs the handler logic.- Specified by:
doInvokein 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
@Nonnull protected CriteriaSet buildLookupCriteria(@Nonnull MessageContext messageContext, @Nonnull String entityID, @Nonnull QName role) Build the lookup criteria from the message context data.- Parameters:
messageContext- the current message contextentityID- entityID to lookuprole- role to lookup- Returns:
- the new lookup criteria
-
resolveExisting
@Nullable protected SAMLMetadataContext resolveExisting(@Nonnull MessageContext messageContext, @Nonnull String entityID, @Nonnull QName role) Attempt to resolve an existingSAMLMetadataContextfrom 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
-