Class RememberMeManagerImpl
- java.lang.Object
-
- org.craftercms.security.authentication.impl.RememberMeManagerImpl
-
- All Implemented Interfaces:
RememberMeManager
public class RememberMeManagerImpl extends Object implements RememberMeManager
Default implementation ofRememberMeManager.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthenticationManagerauthenticationManagerprotected AuthenticationServiceauthenticationServiceprotected org.craftercms.commons.crypto.TextEncryptorencryptorprotected ProfileServiceprofileServicestatic StringREMEMBER_ME_COOKIE_NAMEprotected org.craftercms.commons.http.CookieManagerrememberMeCookieManagerstatic charSERIALIZED_LOGIN_SEPARATOR
-
Constructor Summary
Constructors Constructor Description RememberMeManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRememberMeCookie(String cookieValue, javax.servlet.http.HttpServletResponse response)protected Authenticationauthenticate(String profileId)AuthenticationautoLogin(org.craftercms.commons.http.RequestContext context)Attempts auto login if a remember me cookie is present in the current requestprotected voiddeleteRememberMeCookie(javax.servlet.http.HttpServletResponse response)protected PersistentLogindeserializeLogin(String serializedLogin)protected voiddisableRememberMe(String loginId, org.craftercms.commons.http.RequestContext context)voiddisableRememberMe(org.craftercms.commons.http.RequestContext context)Disabled remember me for the current authenticated profile, generally by removing remember me cookie.voidenableRememberMe(Authentication authentication, org.craftercms.commons.http.RequestContext context)Enables remember me for the current authenticated profile, generally by adding a remember me cookie.protected PersistentLogingetPersistentLoginFromCookie(javax.servlet.http.HttpServletRequest request)protected StringgetRememberMeCookie(javax.servlet.http.HttpServletRequest request)protected StringserializeLogin(PersistentLogin login)voidsetAuthenticationManager(AuthenticationManager authenticationManager)voidsetAuthenticationService(AuthenticationService authenticationService)voidsetEncryptor(org.craftercms.commons.crypto.TextEncryptor encryptor)voidsetProfileService(ProfileService profileService)voidsetRememberMeCookieManager(org.craftercms.commons.http.CookieManager rememberMeCookieManager)protected voidupdateRememberMe(String loginId, org.craftercms.commons.http.RequestContext context)
-
-
-
Field Detail
-
REMEMBER_ME_COOKIE_NAME
public static final String REMEMBER_ME_COOKIE_NAME
- See Also:
- Constant Field Values
-
SERIALIZED_LOGIN_SEPARATOR
public static final char SERIALIZED_LOGIN_SEPARATOR
- See Also:
- Constant Field Values
-
authenticationService
protected AuthenticationService authenticationService
-
authenticationManager
protected AuthenticationManager authenticationManager
-
profileService
protected ProfileService profileService
-
encryptor
protected org.craftercms.commons.crypto.TextEncryptor encryptor
-
rememberMeCookieManager
protected org.craftercms.commons.http.CookieManager rememberMeCookieManager
-
-
Method Detail
-
setAuthenticationService
public void setAuthenticationService(AuthenticationService authenticationService)
-
setAuthenticationManager
public void setAuthenticationManager(AuthenticationManager authenticationManager)
-
setProfileService
public void setProfileService(ProfileService profileService)
-
setEncryptor
public void setEncryptor(org.craftercms.commons.crypto.TextEncryptor encryptor)
-
setRememberMeCookieManager
public void setRememberMeCookieManager(org.craftercms.commons.http.CookieManager rememberMeCookieManager)
-
autoLogin
public Authentication autoLogin(org.craftercms.commons.http.RequestContext context) throws RememberMeException
Description copied from interface:RememberMeManagerAttempts auto login if a remember me cookie is present in the current request- Specified by:
autoLoginin interfaceRememberMeManager- Parameters:
context- the request context- Returns:
- the authentication if auto login was successful
- Throws:
RememberMeException
-
enableRememberMe
public void enableRememberMe(Authentication authentication, org.craftercms.commons.http.RequestContext context) throws RememberMeException
Description copied from interface:RememberMeManagerEnables remember me for the current authenticated profile, generally by adding a remember me cookie.- Specified by:
enableRememberMein interfaceRememberMeManager- Parameters:
authentication- the authentication objectcontext- the request context- Throws:
RememberMeException
-
disableRememberMe
public void disableRememberMe(org.craftercms.commons.http.RequestContext context) throws RememberMeExceptionDescription copied from interface:RememberMeManagerDisabled remember me for the current authenticated profile, generally by removing remember me cookie.- Specified by:
disableRememberMein interfaceRememberMeManager- Parameters:
context- the request context- Throws:
RememberMeException
-
disableRememberMe
protected void disableRememberMe(String loginId, org.craftercms.commons.http.RequestContext context) throws RememberMeException
- Throws:
RememberMeException
-
updateRememberMe
protected void updateRememberMe(String loginId, org.craftercms.commons.http.RequestContext context) throws RememberMeException
- Throws:
RememberMeException
-
serializeLogin
protected String serializeLogin(PersistentLogin login) throws RememberMeException
- Throws:
RememberMeException
-
deserializeLogin
protected PersistentLogin deserializeLogin(String serializedLogin) throws RememberMeException
- Throws:
RememberMeException
-
addRememberMeCookie
protected void addRememberMeCookie(String cookieValue, javax.servlet.http.HttpServletResponse response)
-
getRememberMeCookie
protected String getRememberMeCookie(javax.servlet.http.HttpServletRequest request)
-
deleteRememberMeCookie
protected void deleteRememberMeCookie(javax.servlet.http.HttpServletResponse response)
-
getPersistentLoginFromCookie
protected PersistentLogin getPersistentLoginFromCookie(javax.servlet.http.HttpServletRequest request)
-
authenticate
protected Authentication authenticate(String profileId) throws AuthenticationException
- Throws:
AuthenticationException
-
-