- All Implemented Interfaces:
public class DelayedLoginAuthenticator extends AuthenticatorAdaptorA basic Authenticator that extends the AuthenticatorAdaptor and overrides the checkUser method
This demonstrates the use of the
DelayedResultReceivercalls to return authentication results after a period of time. A typical module may, for example, make a database call in this period.
Constructors Constructor Description
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
checkUser(UserSession session)The user login authorisation method which is called every time a user tries to login to the server.
initialise(SessionManager sessionManager, DelayedResultReceiver delayedReceiver, ServerNode serverNode, java.lang.String loggerName)Called on startup of the Liberator Auth Module.
Methods inherited from class com.caplin.server.auth.AuthenticatorAdaptor
authoriseHTTP, checkPermissionUpdate, checkRead, checkUpdate, checkWrite, discardObject, globalPermissionUpdate, mapObject, newObject, releaseObject, releaseUser, requestObject, shutdown
public void initialise(SessionManager sessionManager, DelayedResultReceiver delayedReceiver, ServerNode serverNode, java.lang.String loggerName)Description copied from interface:
Called on startup of the Liberator Auth Module.
Allows initialisation of required resources and connections. e.g. reading configuration files, connecting to a database or other external application, or constructing internal data structures.
The logger name can be used for obtaining the native logger java.util.logging.Logger.getLogger(String). This logger will log messages to the Liberator's auth log file.
- Specified by:
SessionManagerinstance that can be used for invalidating and ejecting user sessions in the Liberator.
DelayedResultReceiverinstance that can be used for sending delayed authentication results after an
ServerNodeinstance that provides access to information about the server and its session count.
loggerName- the name of the logger that provides native logging output to the Liberator's auth log file (by default auth-rttpd.log).
- See Also:
public AuthenticationResult checkUser(UserSession session)Description copied from interface:
The user login authorisation method which is called every time a user tries to login to the server.
This method should be used to perform authorisation of the user's credentials.
If the authentication requires the use of an external service (e.g. database) to verify the user credentials, the AuthenticationResult.DELAYED return code should be used, followed by a call to
DelayedResultReceiver#delayedCheckUserResultwhen the result is available. This mechanism avoids the Liberator thread beeing blocked whilst waiting for the result, and the obvious associated performance impact.
N.B. The delayed result functionality is only available for the checkUser and mapObject methods. To avoid unnecessary delays during methods such as checkRead, if the user's permission set is contained in a remote database or service, then it can be beneficial to cache this locally at logon time during this method execution.
Subsequent permission checks such as checkRead can then access the locally cached permission set for optimal performance.
If the cached permissions are then modified, then
SessionManager#invalidateSessionsmethods can be used as necessary to force the Liberator to re-validate the user's permissions.
- Specified by:
UserSessionobject containing information about the user and their login details.
AuthenticationResultinstance - usually
AuthenticationResult.DENYor one of the specific failure results such as
- See Also: