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 AuthenticationManager
authenticationManager
protected org.craftercms.profile.api.services.AuthenticationService
authenticationService
protected org.craftercms.commons.crypto.TextEncryptor
encryptor
protected org.craftercms.profile.api.services.ProfileService
profileService
static String
REMEMBER_ME_COOKIE_NAME
protected org.craftercms.commons.http.CookieManager
rememberMeCookieManager
static char
SERIALIZED_LOGIN_SEPARATOR
-
Constructor Summary
Constructors Constructor Description RememberMeManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addRememberMeCookie(String cookieValue, javax.servlet.http.HttpServletResponse response)
protected Authentication
authenticate(String profileId)
Authentication
autoLogin(org.craftercms.commons.http.RequestContext context)
Attempts auto login if a remember me cookie is present in the current requestprotected void
deleteRememberMeCookie(javax.servlet.http.HttpServletResponse response)
protected org.craftercms.profile.api.PersistentLogin
deserializeLogin(String serializedLogin)
protected void
disableRememberMe(String loginId, org.craftercms.commons.http.RequestContext context)
void
disableRememberMe(org.craftercms.commons.http.RequestContext context)
Disabled remember me for the current authenticated profile, generally by removing remember me cookie.void
enableRememberMe(Authentication authentication, org.craftercms.commons.http.RequestContext context)
Enables remember me for the current authenticated profile, generally by adding a remember me cookie.protected org.craftercms.profile.api.PersistentLogin
getPersistentLoginFromCookie(javax.servlet.http.HttpServletRequest request)
protected String
getRememberMeCookie(javax.servlet.http.HttpServletRequest request)
protected String
serializeLogin(org.craftercms.profile.api.PersistentLogin login)
void
setAuthenticationManager(AuthenticationManager authenticationManager)
void
setAuthenticationService(org.craftercms.profile.api.services.AuthenticationService authenticationService)
void
setEncryptor(org.craftercms.commons.crypto.TextEncryptor encryptor)
void
setProfileService(org.craftercms.profile.api.services.ProfileService profileService)
void
setRememberMeCookieManager(org.craftercms.commons.http.CookieManager rememberMeCookieManager)
protected void
updateRememberMe(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 org.craftercms.profile.api.services.AuthenticationService authenticationService
-
authenticationManager
protected AuthenticationManager authenticationManager
-
profileService
protected org.craftercms.profile.api.services.ProfileService profileService
-
encryptor
protected org.craftercms.commons.crypto.TextEncryptor encryptor
-
rememberMeCookieManager
protected org.craftercms.commons.http.CookieManager rememberMeCookieManager
-
-
Method Detail
-
setAuthenticationService
public void setAuthenticationService(org.craftercms.profile.api.services.AuthenticationService authenticationService)
-
setAuthenticationManager
public void setAuthenticationManager(AuthenticationManager authenticationManager)
-
setProfileService
public void setProfileService(org.craftercms.profile.api.services.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:RememberMeManager
Attempts auto login if a remember me cookie is present in the current request- Specified by:
autoLogin
in 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:RememberMeManager
Enables remember me for the current authenticated profile, generally by adding a remember me cookie.- Specified by:
enableRememberMe
in interfaceRememberMeManager
- Parameters:
authentication
- the authentication objectcontext
- the request context- Throws:
RememberMeException
-
disableRememberMe
public void disableRememberMe(org.craftercms.commons.http.RequestContext context) throws RememberMeException
Description copied from interface:RememberMeManager
Disabled remember me for the current authenticated profile, generally by removing remember me cookie.- Specified by:
disableRememberMe
in 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(org.craftercms.profile.api.PersistentLogin login) throws RememberMeException
- Throws:
RememberMeException
-
deserializeLogin
protected org.craftercms.profile.api.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 org.craftercms.profile.api.PersistentLogin getPersistentLoginFromCookie(javax.servlet.http.HttpServletRequest request)
-
authenticate
protected Authentication authenticate(String profileId) throws AuthenticationException
- Throws:
AuthenticationException
-
-