Class SimpleServerAuthConfig
- java.lang.Object
-
- org.apache.catalina.authenticator.jaspic.SimpleServerAuthConfig
-
- All Implemented Interfaces:
AuthConfig,ServerAuthConfig
public class SimpleServerAuthConfig extends java.lang.Object implements ServerAuthConfig
Basic implementation primarily intended for use when using third-partyServerAuthModuleimplementations that only provide the module. This implementation supports configuring theServerAuthContextwith multiple modules.
-
-
Constructor Summary
Constructors Constructor Description SimpleServerAuthConfig(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler handler, java.util.Map<java.lang.String,java.lang.Object> properties)Creates a new SimpleServerAuthConfig.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ServerAuthContextcreateServerAuthContext(java.util.List<ServerAuthModule> modules)Creates the ServerAuthContext.java.lang.StringgetAppContext()Returns the application context for which this configuration applies.ServerAuthContextgetAuthContext(java.lang.String authContextID, javax.security.auth.Subject serviceSubject, java.util.Map<java.lang.String,java.lang.Object> properties)Returns theServerAuthContextfor the given authentication context ID.java.lang.StringgetAuthContextID(MessageInfo messageInfo)Determines the authentication context ID for the given message.java.lang.StringgetMessageLayer()Returns the message layer for which this configuration applies.booleanisProtected()Indicates whether the authentication mechanism is protected, meaning that the configuration data is stored securely.voidrefresh()Refreshes the configuration, reloading any changed settings.
-
-
-
Constructor Detail
-
SimpleServerAuthConfig
public SimpleServerAuthConfig(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler handler, java.util.Map<java.lang.String,java.lang.Object> properties)Creates a new SimpleServerAuthConfig.- Parameters:
layer- Message layerappContext- Application contexthandler- Callback handlerproperties- Configuration properties
-
-
Method Detail
-
getMessageLayer
public java.lang.String getMessageLayer()
Description copied from interface:jakarta.security.auth.message.config.AuthConfigReturns the message layer for which this configuration applies.- Specified by:
getMessageLayerin interfaceAuthConfig- Returns:
- the message layer
-
getAppContext
public java.lang.String getAppContext()
Description copied from interface:jakarta.security.auth.message.config.AuthConfigReturns the application context for which this configuration applies.- Specified by:
getAppContextin interfaceAuthConfig- Returns:
- the application context
-
getAuthContextID
public java.lang.String getAuthContextID(MessageInfo messageInfo)
Determines the authentication context ID for the given message.Returns the MessageInfo's string representation as the auth context ID.
- Specified by:
getAuthContextIDin interfaceAuthConfig- Parameters:
messageInfo- the message information used to determine the context ID- Returns:
- the authentication context ID, or
nullif no context applies
-
refresh
public void refresh()
Refreshes the configuration, reloading any changed settings.Clears the cached ServerAuthConfig so it will be recreated on next use.
- Specified by:
refreshin interfaceAuthConfig
-
isProtected
public boolean isProtected()
Indicates whether the authentication mechanism is protected, meaning that the configuration data is stored securely.This implementation always returns
false.- Specified by:
isProtectedin interfaceAuthConfig- Returns:
trueif the mechanism is protected,falseotherwise
-
getAuthContext
public ServerAuthContext getAuthContext(java.lang.String authContextID, javax.security.auth.Subject serviceSubject, java.util.Map<java.lang.String,java.lang.Object> properties) throws AuthException
Returns theServerAuthContextfor the given authentication context ID.Loads ServerAuthModule instances from properties keyed with
org.apache.catalina.authenticator.jaspic.ServerAuthModule.Nwhere N is 1-based index. The returned context is cached and reused for subsequent calls.- Specified by:
getAuthContextin interfaceServerAuthConfig- Parameters:
authContextID- the authentication context identifierserviceSubject- the service subjectproperties- the configuration properties- Returns:
- the server authentication context
- Throws:
AuthException- if an error occurs during authentication context creation
-
createServerAuthContext
protected ServerAuthContext createServerAuthContext(java.util.List<ServerAuthModule> modules)
Creates the ServerAuthContext. Can be overridden by subclasses to provide a custom implementation.- Parameters:
modules- List of ServerAuthModule instances- Returns:
- The ServerAuthContext instance
-
-