Class SimpleAuthenticationHandler
java.lang.Object
com.jalios.jcms.authentication.AuthenticationHandler
com.jalios.jcms.authentication.handlers.SimpleAuthenticationHandler
- All Implemented Interfaces:
PluginComponent,Comparable<AuthenticationHandler>
Authenticate user based on the login/password of existing member in JCMS.
Current implementation of this
Current implementation of this
AuthenticationHandler :
- stops the LoginChain on empty login or password. Therefore if your AuthenticationHandler happened to be before this one, make sure you check those too.
- invokes the login chain, THEN tries the JCMS login/password if no user was authenticated using other handler.
- redirects to the proper page after login.
- invalidates session on logout and redirect to index page (or redirect param).
- Since:
- jcms-5.7.0
- Author:
- Olivier Jaquemet
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible SimpleAuth state after handler invocation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringBoolean property key used to authorized or forbid LDAP user to login with their local password.static final intOrder used by the SimpleAuthenticationHandlerFields inherited from class com.jalios.jcms.authentication.AuthenticationHandler
channel, GENERIC_BAD_AUTHENTICATION_MSG -
Method Summary
Modifier and TypeMethodDescriptionstatic final MembergetAuthenticatedMember(String login, String password) Returns the member corresponding to the given login / password by checking directly into existing Member.static final SimpleAuthenticationHandlervoidThis method will be called by the AuthenticationManager each time the Channel properties are loaded/reloaded.
You can use it to reload properties that might have been changed.
This method is called during initialization of the AuthenticationManagervoidlogin(AuthenticationContext ctxt) Authenticate a member.voidlogout(AuthenticationContext ctxt) This methods is called when users logout from JCMS.
-
Field Details
-
ORDER_SIMPLE_HANDLER
public static final int ORDER_SIMPLE_HANDLEROrder used by the SimpleAuthenticationHandler- See Also:
-
LDAP_USER_LOCAL_PASSWORD_AUTHORIZED_PROP
Boolean property key used to authorized or forbid LDAP user to login with their local password.- Since:
- JCMS-6504
- See Also:
-
-
Method Details
-
getInstance
-
loadProperties
public void loadProperties()Description copied from class:AuthenticationHandlerThis method will be called by the AuthenticationManager each time the Channel properties are loaded/reloaded.
You can use it to reload properties that might have been changed.
This method is called during initialization of the AuthenticationManager- Overrides:
loadPropertiesin classAuthenticationHandler
-
login
Description copied from class:AuthenticationHandlerAuthenticate a member.
This method is invoked by the authentication chain on each request.
A typical implementation of this method would follow the following pattern :- Examine informations required to perform the authentication through
the
AuthenticationContextobject (request, response, login.. etc) - Perform your authentication before chain invokation and set the logged Member
AuthenticationContext.setLoggedMember(com.jalios.jcms.Member) - a) Either invoke the next entity in the chain using
AuthenticationContext.doChain(), - b) or else skip the chain invokation and block other authentication handler of the chain (do this with caution...)
- Perform redirection, set information/warning/error message or any
other process, after chain invokation, using
AuthenticationContext.
Default implementation is to invoke the next handler in the chain.- Overrides:
loginin classAuthenticationHandler- Parameters:
ctxt- theAuthenticationContextused for this login- Throws:
IOException
- Examine informations required to perform the authentication through
the
-
logout
Description copied from class:AuthenticationHandlerThis methods is called when users logout from JCMS.
It may not be called if user simply close its browser. Don't rely on this for critical operation
Default implementation is to invoke the next handler in the chain.- Overrides:
logoutin classAuthenticationHandler- Parameters:
ctxt- theAuthenticationContextused for this login- Throws:
IOException
-
getAuthenticatedMember
Returns the member corresponding to the given login / password by checking directly into existing Member.- Parameters:
login- member's loginpassword- member's password- Returns:
- the member or null if not found or if password was invalid
- Since:
- jcms-5.7.0
-