Class OIDCProviderMetadataLookupHandler

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
net.shibboleth.sp.oidc.metadata.impl.OIDCProviderMetadataLookupHandler
All Implemented Interfaces:
net.shibboleth.shared.component.Component, net.shibboleth.shared.component.DestructableComponent, net.shibboleth.shared.component.InitializableComponent, org.opensaml.messaging.handler.MessageHandler

public class OIDCProviderMetadataLookupHandler extends org.opensaml.messaging.handler.AbstractMessageHandler
Handler for inbound OIDC protocol messages that attempts to locate OIDC metadata for a OP (issuer), and attaches it with a OIDCMetadataContext as a child of a pre-existing instance of MessageContext.

If the optional copy strategy is configured via setCopyContextStrategy(Function), and if that lookup finds an existing metadata context with compatible data (matching the IssuerID), then its data will be re-used.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Function<org.opensaml.messaging.context.MessageContext,? extends net.shibboleth.oidc.profile.messaging.context.AbstractOIDCEntityContext>
    Strategy to resolve the context class to add the resolved metadata too.
    private Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext>
    Optional strategy for resolving an existing metadata context from which to copy data.
    private final org.slf4j.Logger
    Logger.
    private Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.ProviderMetadataResolver>
    Resolver used to look up OIDC metadata.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doInvoke(org.opensaml.messaging.context.MessageContext messageContext)
     
    protected net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext
    resolveExisting(org.opensaml.messaging.context.MessageContext messageContext, String issuer)
    Attempt to resolve an existing OIDCProviderMetadataContext from which to copy.
    void
    setContextClassLookupStrategy(Function<org.opensaml.messaging.context.MessageContext,? extends net.shibboleth.oidc.profile.messaging.context.AbstractOIDCEntityContext> strategy)
    Set the context class lookup strategy.
    void
    setCopyContextStrategy(Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext> strategy)
    Set the optional strategy for resolving an existing metadata context from which to copy data.
    void
    setProviderMetadataResolver(net.shibboleth.oidc.metadata.ProviderMetadataResolver resolver)
    Set the ProviderMetadataResolver to use.
    void
    setProviderMetadataResolverLookupStrategy(Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.ProviderMetadataResolver> strategy)
    Set the lookup strategy for the ProviderMetadataResolver to use.

    Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler

    doPostInvoke, doPostInvoke, doPreInvoke, getActivationCondition, getLogPrefix, invoke, isPreInvokeCalled, setActivationCondition

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, 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.shared.component.InitializableComponent

    initialize, isInitialized
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Logger.
    • metadataResolverLookupStrategy

      @Nonnull private Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.ProviderMetadataResolver> metadataResolverLookupStrategy
      Resolver used to look up OIDC metadata.
    • contextClassLookupStrategy

      @Nonnull private Function<org.opensaml.messaging.context.MessageContext,? extends net.shibboleth.oidc.profile.messaging.context.AbstractOIDCEntityContext> contextClassLookupStrategy
      Strategy to resolve the context class to add the resolved metadata too.
    • copyContextStrategy

      @Nullable private Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext> copyContextStrategy
      Optional strategy for resolving an existing metadata context from which to copy data.
  • Constructor Details

    • OIDCProviderMetadataLookupHandler

      public OIDCProviderMetadataLookupHandler()
      Constructor.
  • Method Details

    • setContextClassLookupStrategy

      public void setContextClassLookupStrategy(@Nonnull Function<org.opensaml.messaging.context.MessageContext,? extends net.shibboleth.oidc.profile.messaging.context.AbstractOIDCEntityContext> strategy)
      Set the context class lookup strategy.
      Parameters:
      strategy - the strategy.
    • setCopyContextStrategy

      public void setCopyContextStrategy(@Nullable Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext> strategy)
      Set the optional strategy for resolving an existing metadata context from which to copy data.
      Parameters:
      strategy - the strategy function
    • setProviderMetadataResolver

      public void setProviderMetadataResolver(@Nonnull net.shibboleth.oidc.metadata.ProviderMetadataResolver resolver)
      Set the ProviderMetadataResolver to use.
      Parameters:
      resolver - The resolver to use.
    • setProviderMetadataResolverLookupStrategy

      public void setProviderMetadataResolverLookupStrategy(@Nonnull Function<org.opensaml.messaging.context.MessageContext,net.shibboleth.oidc.metadata.ProviderMetadataResolver> strategy)
      Set the lookup strategy for the ProviderMetadataResolver to use.
      Parameters:
      strategy - lookup strategy
    • doInvoke

      protected void doInvoke(org.opensaml.messaging.context.MessageContext messageContext) throws org.opensaml.messaging.handler.MessageHandlerException
      Specified by:
      doInvoke in class org.opensaml.messaging.handler.AbstractMessageHandler
      Throws:
      org.opensaml.messaging.handler.MessageHandlerException
    • resolveExisting

      @Nullable protected net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext resolveExisting(@Nonnull org.opensaml.messaging.context.MessageContext messageContext, @Nonnull String issuer)
      Attempt to resolve an existing OIDCProviderMetadataContext 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 context
      issuer - the identifier of the issuer against which to match
      Returns:
      a new instance of SAMLMetadataContext, or null if one can not be resolved