AuthConfigFactory (JASPIC 3.1 API Documentation - Apache Tomcat 11.0.24)
Description: declaration: package: jakarta.security.auth.message.config, class: AuthConfigFactory

# Class AuthConfigFactory

java.lang.Object
jakarta.security.auth.message.config.AuthConfigFactory

public abstract class AuthConfigFactory extends Object
Factory for obtaining and managing `AuthConfigProvider` instances. The AuthConfigFactory is responsible for discovering, registering, and providing configuration providers for JASPIC authentication modules. Use `getFactory()` to obtain the singleton instance.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `AuthConfigFactory.RegistrationContext`
  Provides information about a registered `AuthConfigProvider`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_FACTORY_SECURITY_PROPERTY`
  The name of the `Security` property used to specify the AuthConfigFactory implementation class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AuthConfigFactory()`
  Protected constructor for subclasses.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract String[]`
  `detachListener(RegistrationListener listener, String layer, String appContext)`
  Detaches a listener from all registrations matching the given layer and application context, returning the affected registration IDs.
  `abstract AuthConfigProvider`
  `getConfigProvider(String layer, String appContext, RegistrationListener listener)`
  Returns the `AuthConfigProvider` for the specified message layer and application context.
  `static AuthConfigFactory`
  `getFactory()`
  Returns the singleton AuthConfigFactory instance.
  `abstract AuthConfigFactory.RegistrationContext`
  `getRegistrationContext(String registrationID)`
  Returns the `AuthConfigFactory.RegistrationContext` for the given registration ID.
  `abstract String[]`
  `getRegistrationIDs(AuthConfigProvider provider)`
  Returns the registration IDs associated with the given AuthConfigProvider.
  `abstract void`
  `refresh()`
  Refreshes all registered AuthConfigProviders, causing them to reload their configuration.
  `abstract String`
  `registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description)`
  Registers an AuthConfigProvider instance.
  `abstract String`
  `registerConfigProvider(String className, Map<String,String> properties, String layer, String appContext, String description)`
  Registers an AuthConfigProvider by class name with the given properties.
  `abstract String`
  `registerServerAuthModule(ServerAuthModule serverAuthModule, Object context)`
  Convenience method for registering a `ServerAuthModule` that should have the same effect as calling `registerConfigProvider(AuthConfigProvider, String, String, String)` with the implementation providing the appropriate `AuthConfigProvider` generated from the provided context.
  `abstract boolean`
  `removeRegistration(String registrationID)`
  Removes a registration by its ID.
  `abstract void`
  `removeServerAuthModule(Object context)`
  Convenience method for deregistering a `ServerAuthModule` that should have the same effect as calling `removeRegistration(String)`.
  `static void`
  `setFactory(AuthConfigFactory factory)`
  Programmatically sets the AuthConfigFactory instance.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_FACTORY_SECURITY_PROPERTY

    public static final String DEFAULT_FACTORY_SECURITY_PROPERTY
    The name of the `Security` property used to specify the AuthConfigFactory implementation class.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AuthConfigFactory

    public AuthConfigFactory()
    Protected constructor for subclasses.

- ## Method Details

  - ### getFactory

    public static AuthConfigFactory getFactory()
    Returns the singleton AuthConfigFactory instance. If no instance has been set via `setFactory(AuthConfigFactory)`, the factory class is discovered from the `Security` property "authconfigprovider.factory", or falls back to a default implementation.
    Returns:
      the AuthConfigFactory instance

  - ### setFactory

    public static void setFactory(AuthConfigFactory factory)
    Programmatically sets the AuthConfigFactory instance. This method is typically used by containers to provide their own implementation.
    Parameters:
      `factory` - the AuthConfigFactory instance to set

  - ### getConfigProvider

    public abstract AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener)
    Returns the `AuthConfigProvider` for the specified message layer and application context.
    Parameters:
      `layer` - the message layer
      `appContext` - the application context
      `listener` - the registration listener to attach
    Returns:
      the AuthConfigProvider, or `null` if none is available

  - ### registerConfigProvider

    public abstract String registerConfigProvider(String className, Map<String,String> properties, String layer, String appContext, String description)
    Registers an AuthConfigProvider by class name with the given properties.
    Parameters:
      `className` - the fully qualified class name of the AuthConfigProvider
      `properties` - the configuration properties
      `layer` - the message layer
      `appContext` - the application context
      `description` - a description of the registration
    Returns:
      a unique registration ID

  - ### registerConfigProvider

    public abstract String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description)
    Registers an AuthConfigProvider instance.
    Parameters:
      `provider` - the AuthConfigProvider to register
      `layer` - the message layer
      `appContext` - the application context
      `description` - a description of the registration
    Returns:
      a unique registration ID

  - ### removeRegistration

    public abstract boolean removeRegistration(String registrationID)
    Removes a registration by its ID.
    Parameters:
      `registrationID` - the registration ID to remove
    Returns:
      `true` if the registration was removed, `false` if it did not exist

  - ### detachListener

    public abstract String[] detachListener(RegistrationListener listener, String layer, String appContext)
    Detaches a listener from all registrations matching the given layer and application context, returning the affected registration IDs.
    Parameters:
      `listener` - the listener to detach
      `layer` - the message layer
      `appContext` - the application context
    Returns:
      an array of registration IDs from which the listener was detached

  - ### getRegistrationIDs

    public abstract String[] getRegistrationIDs(AuthConfigProvider provider)
    Returns the registration IDs associated with the given AuthConfigProvider.
    Parameters:
      `provider` - the AuthConfigProvider
    Returns:
      an array of registration IDs

  - ### getRegistrationContext

    public abstract AuthConfigFactory.RegistrationContext getRegistrationContext(String registrationID)
    Returns the `AuthConfigFactory.RegistrationContext` for the given registration ID.
    Parameters:
      `registrationID` - the registration ID
    Returns:
      the RegistrationContext, or `null` if the ID is not found

  - ### refresh

    public abstract void refresh()
    Refreshes all registered AuthConfigProviders, causing them to reload their configuration.

  - ### registerServerAuthModule

    public abstract String registerServerAuthModule(ServerAuthModule serverAuthModule, Object context)
    Convenience method for registering a `ServerAuthModule` that should have the same effect as calling `registerConfigProvider(AuthConfigProvider, String, String, String)` with the implementation providing the appropriate `AuthConfigProvider` generated from the provided context.
    Parameters:
      `serverAuthModule` - The `ServerAuthModule` to register
      `context` - The associated application context
    Returns:
      A string identifier for the created registration
    Since:
      Authentication 3.0

  - ### removeServerAuthModule

    public abstract void removeServerAuthModule(Object context)
    Convenience method for deregistering a `ServerAuthModule` that should have the same effect as calling `removeRegistration(String)`.
    Parameters:
      `context` - The associated application context
    Since:
      Authentication 3.0