Package com.jalios.jcms.authentication
Class AuthenticationManager
java.lang.Object
com.jalios.jcms.authentication.AuthenticationManager
This singleton manages all the authentication process in JCMS.
It is responsible to store and invoke all the
It is responsible to store and invoke all the
AuthenticationHandler.- Since:
- jcms-5.7.0
- Author:
- Olivier Jaquemet
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specified AuthenticationHandler to the handlers collection already managed by the AuthenticationManager.Retrieve the internal set ofAuthenticationHandlermanaged by the AuthenticationManager.
Modify only if you are sure of what you do...booleanDefined by value of propertyauth-mgr.persistent.default-value.static final AuthenticationManagerRetrieve the parameter name used for the user's login.
Defined by value of propertyauth-mgr.login-param.login.Retrieve the parameter name used to indicate a login action is requested (login form submitted).
Defined by value of propertyauth-mgr.login-param.op-login.Retrieve the parameter name used for the user's password.
Defined by value of propertyauth-mgr.login-param.password.Retrieve the parameter name used for the user's persistent login preference.
Defined by value of propertyauth-mgr.login-param.persistent.voidinit()Initialize the AuthenticationManager.
This method can be called multiple time during the lifetime of the site, for example on properties change.booleanReturns true if the authentication is required in this site.
Defined by value of propertychannel.is-authentication-required.booleanReturns true if login should be treated as accent sensitive (mylogin != mylogìn).booleanReturns true if login should be treated as case sensitive (myLogin != mylogin).booleanDefined by value of propertyauth-mgr.persistent.show-option.Retrieve a member from a login/password pair.
Current implementation invoke the authentication handler login chain with current servlet request if available otherwise with a fake request, and a fake response.login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String userLang) Deprecated.login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale userLocale) Authenticate a member for each request.
Invoke the authentication handler chain and return the authenticated Member.voidlogout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String userLang, Member loggedMember) Deprecated.voidlogout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale userLocale, Member loggedMember) Logout the current loggedMember from this session.voidRead Authentication Handlers order from properties.voidRemove the specified AuthenticationHandler from the handlers managed by the AuthenticationManager.
-
Method Details
-
getInstance
-
init
public void init()Initialize the AuthenticationManager.
This method can be called multiple time during the lifetime of the site, for example on properties change.- Since:
- jcms-5.7.0
-
readOrdersFromProperties
public void readOrdersFromProperties()Read Authentication Handlers order from properties. -
addAuthenticationHandler
Add the specified AuthenticationHandler to the handlers collection already managed by the AuthenticationManager.- Parameters:
authHdlr- the AuthenticationHandler to be added- Since:
- jcms-5.7.0
-
removeAuthenticationHandler
Remove the specified AuthenticationHandler from the handlers managed by the AuthenticationManager.- Parameters:
authHdlr- the AuthenticationHandler to be removed- Since:
- jcms-5.7.0
-
getAuthenticationHandlerSet
Retrieve the internal set ofAuthenticationHandlermanaged by the AuthenticationManager.
Modify only if you are sure of what you do...- Returns:
- a SortedSet of
AuthenticationHandler
-
isAuthenticationRequired
public boolean isAuthenticationRequired()Returns true if the authentication is required in this site.
Defined by value of propertychannel.is-authentication-required.- Returns:
- true if authentication is required for JCMS acces, false otherwise.
- Since:
- jcms-5.7.0
-
isLoginCaseSensitive
public boolean isLoginCaseSensitive()Returns true if login should be treated as case sensitive (myLogin != mylogin). Defined by value of propertychannel.login-casesensitive.- Returns:
- true if login is case sensitive
- Since:
- jcms-5.7.0
-
isLoginAccentSensitive
public boolean isLoginAccentSensitive()Returns true if login should be treated as accent sensitive (mylogin != mylogìn). Defined by value of propertychannel.login-accentsensitive.- Returns:
- true if login is accent sensitive
- Since:
- jcms-8.0.2
-
isShowingPersistentOption
public boolean isShowingPersistentOption()Defined by value of propertyauth-mgr.persistent.show-option.- Returns:
- true if we show the persistent option in the login form, false if we hide it.
- Since:
- jcms-5.7.0
-
getDefaultPersistentValue
public boolean getDefaultPersistentValue()Defined by value of propertyauth-mgr.persistent.default-value.- Returns:
- the default persistent value, true is persistent, false is not.
- Since:
- jcms-5.7.0
-
getLoginParameter
Retrieve the parameter name used for the user's login.
Defined by value of propertyauth-mgr.login-param.login.- Returns:
- the request parameter name used to send/retrieve the login of the user to authenticate.
- Since:
- jcms-5.7.0
-
getPasswordParameter
Retrieve the parameter name used for the user's password.
Defined by value of propertyauth-mgr.login-param.password.- Returns:
- the request parameter name used to send/retrieve the password of the user to authenticate.
- Since:
- jcms-5.7.0
-
getPersistentParameter
Retrieve the parameter name used for the user's persistent login preference.
Defined by value of propertyauth-mgr.login-param.persistent.- Returns:
- the request parameter name used to send/retrieve whether user to authenticate has requested to have a persistent authentication or not.
- Since:
- jcms-5.7.0
-
getOpLoginParameter
Retrieve the parameter name used to indicate a login action is requested (login form submitted).
Defined by value of propertyauth-mgr.login-param.op-login.- Returns:
- the request parameter name used to send/retrieve whether a login action has been requested (usually when a form is submitted).
- Since:
- jcms-5.7.0
-
login
Retrieve a member from a login/password pair.
Current implementation invoke the authentication handler login chain with current servlet request if available otherwise with a fake request, and a fake response.- Parameters:
login- the user loginpassword- the user's clear text password- Returns:
- the authenticated
Member, (or null on error) - Throws:
IOException- if the login operation could not be performed due to IO problem (HTTP headers in response, cookie error, ...)- Since:
- jcms-5.7.0
-
login
public LoginResult login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String userLang) throws IOException Deprecated.Authenticate a member for each request.
Invoke the authentication handler chain and return the authenticated Member.- Parameters:
request- the current HttpServletRequest being processedresponse- the HttpServletResponse bound to current requestuserLang- the current language guessed from browser preference or session- Returns:
- the LoginResult containing the logged
Member - Throws:
IOException- if the login operation could not be performed due to IO problem (HTTP headers in response, cookie error, ...)- Since:
- jcms-5.7.0
-
login
public LoginResult login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale userLocale) throws IOException Authenticate a member for each request.
Invoke the authentication handler chain and return the authenticated Member.- Parameters:
request- the current HttpServletRequest being processedresponse- the HttpServletResponse bound to current requestuserLocale- the current Locale guessed from browser preference or session- Returns:
- the LoginResult containing the logged
Member - Throws:
IOException- if the login operation could not be performed due to IO problem (HTTP headers in response, cookie error, ...)- Since:
- jcms-7.1.0
-
logout
public void logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String userLang, Member loggedMember) throws IOException Deprecated.Logout the current loggedMember from this session. It may not be called if user simply close its browser. Don't rely on this for critical operation- Parameters:
request- the current HttpServletRequest being processedresponse- the HttpServletResponse bound to current requestuserLang- the current language guessed from browser preference or sessionloggedMember- the member currently logged in- Throws:
IOException- if the logout operation could not be performed due to IO problem (HTTP headers in response, cookie error, ...)- Since:
- jcms-5.7.0
-
logout
public void logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale userLocale, Member loggedMember) throws IOException Logout the current loggedMember from this session. It may not be called if user simply close its browser. Don't rely on this for critical operation- Parameters:
request- the current HttpServletRequest being processedresponse- the HttpServletResponse bound to current requestuserLocale- the current Locale guessed from browser preference or sessionloggedMember- the member currently logged in- Throws:
IOException- if the logout operation could not be performed due to IO problem (HTTP headers in response, cookie error, ...)- Since:
- jcms-7.1.0
-
login(HttpServletRequest, HttpServletResponse, Locale)