Class LoginProcessor
java.lang.Object
org.craftercms.security.processors.impl.LoginProcessor
- All Implemented Interfaces:
RequestSecurityProcessor
Processes login requests.
- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthenticationManagerstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final org.slf4j.Loggerprotected LoginFailureHandlerprotected Stringprotected LoginSuccessHandlerprotected Stringprotected Stringprotected RememberMeManagerprotected Stringprotected TenantsResolverprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclearSession(javax.servlet.http.HttpServletRequest request) protected StringgetPassword(javax.servlet.http.HttpServletRequest request) protected booleangetRememberMe(javax.servlet.http.HttpServletRequest request) protected StringgetUsername(javax.servlet.http.HttpServletRequest request) protected booleanisLoginRequest(javax.servlet.http.HttpServletRequest request) protected voidonLoginFailure(org.craftercms.commons.http.RequestContext context, AuthenticationException e) protected voidonLoginSuccess(org.craftercms.commons.http.RequestContext context, Authentication authentication) voidprocessRequest(org.craftercms.commons.http.RequestContext context, RequestSecurityProcessorChain processorChain) Checks if the request URL matches theloginUrland the HTTP method matches theloginMethod.protected voidsaveException(javax.servlet.http.HttpServletRequest request, AuthenticationException e) voidsetAuthenticationManager(AuthenticationManager authenticationManager) voidsetLoginFailureHandler(LoginFailureHandler loginFailureHandler) voidsetLoginMethod(String loginMethod) voidsetLoginSuccessHandler(LoginSuccessHandler loginSuccessHandler) voidsetLoginUrl(String loginUrl) voidsetPasswordParameter(String passwordParameter) voidsetRememberMeManager(RememberMeManager rememberMeManager) voidsetRememberMeParameter(String rememberMeParameter) voidsetTenantsResolver(TenantsResolver tenantsResolver) voidsetUsernameParameter(String usernameParameter)
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
DEFAULT_LOGIN_URL
- See Also:
-
DEFAULT_LOGIN_METHOD
- See Also:
-
DEFAULT_USERNAME_PARAM
- See Also:
-
DEFAULT_PASSWORD_PARAM
- See Also:
-
DEFAULT_REMEMBER_ME_PARAM
- See Also:
-
loginUrl
-
loginMethod
-
usernameParameter
-
passwordParameter
-
rememberMeParameter
-
tenantsResolver
-
authenticationManager
-
loginSuccessHandler
-
loginFailureHandler
-
rememberMeManager
-
-
Constructor Details
-
LoginProcessor
public LoginProcessor()Default constructor.
-
-
Method Details
-
setLoginUrl
-
setLoginMethod
-
setPasswordParameter
-
setUsernameParameter
-
setRememberMeParameter
-
setAuthenticationManager
-
setLoginSuccessHandler
-
setLoginFailureHandler
-
setRememberMeManager
-
setTenantsResolver
-
processRequest
public void processRequest(org.craftercms.commons.http.RequestContext context, RequestSecurityProcessorChain processorChain) throws Exception Checks if the request URL matches theloginUrland the HTTP method matches theloginMethod. If it does, it proceeds to login the user using the username/password specified in the parameters.- Specified by:
processRequestin interfaceRequestSecurityProcessor- Parameters:
context- the context which holds the current request and responseprocessorChain- the processor chain, used to call the next processor- Throws:
Exception
-
isLoginRequest
protected boolean isLoginRequest(javax.servlet.http.HttpServletRequest request) -
getUsername
-
getPassword
-
getRememberMe
protected boolean getRememberMe(javax.servlet.http.HttpServletRequest request) -
onLoginSuccess
protected void onLoginSuccess(org.craftercms.commons.http.RequestContext context, Authentication authentication) throws Exception - Throws:
Exception
-
onLoginFailure
protected void onLoginFailure(org.craftercms.commons.http.RequestContext context, AuthenticationException e) throws Exception - Throws:
Exception
-
saveException
protected void saveException(javax.servlet.http.HttpServletRequest request, AuthenticationException e) -
clearSession
protected void clearSession(javax.servlet.http.HttpServletRequest request)
-