Class AuthConfigFactory
java.lang.Object
jakarta.security.auth.message.config.AuthConfigFactory
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 ClassesModifier and TypeClassDescriptionstatic interfaceProvides information about a registeredAuthConfigProvider. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of theSecurityproperty used to specify the AuthConfigFactory implementation class.static final Stringstatic final SecurityPermissionDeprecated, for removal: This API element is subject to removal in a future version.Following JEP 411static final Stringstatic final SecurityPermissionDeprecated, for removal: This API element is subject to removal in a future version.Following JEP 411static final Stringstatic final SecurityPermissionDeprecated, for removal: This API element is subject to removal in a future version.Following JEP 411 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract 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 AuthConfigProvidergetConfigProvider(String layer, String appContext, RegistrationListener listener) Returns theAuthConfigProviderfor the specified message layer and application context.static AuthConfigFactoryReturns the singleton AuthConfigFactory instance.getRegistrationContext(String registrationID) Returns theAuthConfigFactory.RegistrationContextfor the given registration ID.abstract String[]getRegistrationIDs(AuthConfigProvider provider) Returns the registration IDs associated with the given AuthConfigProvider.abstract voidrefresh()Refreshes all registered AuthConfigProviders, causing them to reload their configuration.abstract StringregisterConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description) Registers an AuthConfigProvider instance.abstract StringregisterConfigProvider(String className, Map<String, String> properties, String layer, String appContext, String description) Registers an AuthConfigProvider by class name with the given properties.abstract StringregisterServerAuthModule(ServerAuthModule serverAuthModule, Object context) Convenience method for registering aServerAuthModulethat should have the same effect as callingregisterConfigProvider(AuthConfigProvider, String, String, String)with the implementation providing the appropriateAuthConfigProvidergenerated from the provided context.abstract booleanremoveRegistration(String registrationID) Removes a registration by its ID.abstract voidremoveServerAuthModule(Object context) Convenience method for deregistering aServerAuthModulethat should have the same effect as callingremoveRegistration(String).static voidsetFactory(AuthConfigFactory factory) Programmatically sets the AuthConfigFactory instance.
-
Field Details
-
DEFAULT_FACTORY_SECURITY_PROPERTY
-
GET_FACTORY_PERMISSION_NAME
- See Also:
-
SET_FACTORY_PERMISSION_NAME
- See Also:
-
PROVIDER_REGISTRATION_PERMISSION_NAME
- See Also:
-
getFactorySecurityPermission
Deprecated, for removal: This API element is subject to removal in a future version.Following JEP 411 -
setFactorySecurityPermission
Deprecated, for removal: This API element is subject to removal in a future version.Following JEP 411 -
providerRegistrationSecurityPermission
@Deprecated(forRemoval=true) public static final SecurityPermission providerRegistrationSecurityPermissionDeprecated, for removal: This API element is subject to removal in a future version.Following JEP 411
-
-
Constructor Details
-
AuthConfigFactory
public AuthConfigFactory()Protected constructor for subclasses.
-
-
Method Details
-
getFactory
Returns the singleton AuthConfigFactory instance. If no instance has been set viasetFactory(AuthConfigFactory), the factory class is discovered from theSecurityproperty "authconfigprovider.factory", or falls back to a default implementation.- Returns:
- the AuthConfigFactory instance
-
setFactory
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 theAuthConfigProviderfor the specified message layer and application context.- Parameters:
layer- the message layerappContext- the application contextlistener- the registration listener to attach- Returns:
- the AuthConfigProvider, or
nullif 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 AuthConfigProviderproperties- the configuration propertieslayer- the message layerappContext- the application contextdescription- 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 registerlayer- the message layerappContext- the application contextdescription- a description of the registration- Returns:
- a unique registration ID
-
removeRegistration
Removes a registration by its ID.- Parameters:
registrationID- the registration ID to remove- Returns:
trueif the registration was removed,falseif 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 detachlayer- the message layerappContext- the application context- Returns:
- an array of registration IDs from which the listener was detached
-
getRegistrationIDs
Returns the registration IDs associated with the given AuthConfigProvider.- Parameters:
provider- the AuthConfigProvider- Returns:
- an array of registration IDs
-
getRegistrationContext
Returns theAuthConfigFactory.RegistrationContextfor the given registration ID.- Parameters:
registrationID- the registration ID- Returns:
- the RegistrationContext, or
nullif the ID is not found
-
refresh
public abstract void refresh()Refreshes all registered AuthConfigProviders, causing them to reload their configuration. -
registerServerAuthModule
Convenience method for registering aServerAuthModulethat should have the same effect as callingregisterConfigProvider(AuthConfigProvider, String, String, String)with the implementation providing the appropriateAuthConfigProvidergenerated from the provided context.- Parameters:
serverAuthModule- TheServerAuthModuleto registercontext- The associated application context- Returns:
- A string identifier for the created registration
- Since:
- Authentication 3.0
-
removeServerAuthModule
Convenience method for deregistering aServerAuthModulethat should have the same effect as callingremoveRegistration(String).- Parameters:
context- The associated application context- Since:
- Authentication 3.0
-