Interface ProviderSelectionPolicy

All Known Implementing Classes:
CompositeProviderSelectionPolicy

public interface ProviderSelectionPolicy
A policy that selects provider to use. To support loading from class name, this class must have a public constructor that accepts ProviderSelectionPolicy.Providers as a single parameter, or a public constructor that accepts ProviderSelectionPolicy.Providers and Config if you want your instance to be configurable. To support configuring through a builder pattern, you must provide to security builder a function that accepts ProviderSelectionPolicy.Providers and returns an instance of this interface, which could be the constructor itself.
  • Method Details

    • selectProvider

      <T extends SecurityProvider> Optional<T> selectProvider(Class<T> providerType)
      Select a provider instance of the type defined that this policy has configured as the default.
      Type Parameters:
      T - type of provider
      Parameters:
      providerType - type of provider (one of AuthenticationProvider, AuthorizationProvider)
      Returns:
      security provider instance
    • selectOutboundProviders

      List<OutboundSecurityProvider> selectOutboundProviders()
      Specific method for outbound providers, as we have an option to choose the first outbound provider that matches the current request.
      Returns:
      list of outbound provider to choose from (may be empty)
    • selectProvider

      <T extends SecurityProvider> Optional<T> selectProvider(Class<T> providerType, String requestedName)
      Select a provider instance of the type defined that this policy finds for the requested name.
      Type Parameters:
      T - type of provider
      Parameters:
      providerType - type of provider (one of AuthenticationProvider, AuthorizationProvider or OutboundSecurityProvider)
      requestedName - explicit provider name to find
      Returns:
      security provider instance