egovframework.rfc3.iam.security.authentication.rememberme
Class TokenBasedRememberMeServices
java.lang.Object
   egovframework.rfc3.iam.security.authentication.rememberme.AbstractRememberMeServices
egovframework.rfc3.iam.security.authentication.rememberme.AbstractRememberMeServices
       egovframework.rfc3.iam.security.authentication.rememberme.TokenBasedRememberMeServices
egovframework.rfc3.iam.security.authentication.rememberme.TokenBasedRememberMeServices
- All Implemented Interfaces: 
- RFC3RememberMeServices, org.springframework.beans.factory.InitializingBean, org.springframework.security.web.authentication.logout.LogoutHandler
- public class TokenBasedRememberMeServices 
- extends AbstractRememberMeServices
Identifies previously remembered users by a Base-64 encoded cookie.
 
 This implementation does not rely on an external database, so is attractive
 for simple applications. The cookie will be valid for a specific period from
 the date of the last AbstractRememberMeServices.loginSuccess(HttpServletRequest, HttpServletResponse, Authentication).
 As per the interface contract, this method will only be called when the
 principal completes a successful interactive authentication. As such the time
 period commences from the last authentication attempt where they furnished
 credentials - not the time period they last logged in via remember-me. The
 implementation will only send a remember-me token if the parameter defined by
 AbstractRememberMeServices.setParameter(String) is present.
 
 An UserDetailsService is required by
 this implementation, so that it can construct a valid
 Authentication from the returned UserDetails.
 This is also necessary so that the user's password is available and can be checked as part of the encoded cookie.
 
 The cookie encoded by this implementation adopts the following form:
 
 username + ":" + expiryTime + ":" + Md5Hex(username + ":" + expiryTime + ":" + password + ":" + key)
 
 
 As such, if the user changes their password, any remember-me token will be
 invalidated. Equally, the system administrator may invalidate every
 remember-me token on issue by changing the key. This provides some reasonable
 approaches to recovering from a remember-me token being left on a public
 machine (e.g. kiosk system, Internet cafe etc). Most importantly, at no time is
 the user's password ever sent to the user agent, providing an important
 security safeguard. Unfortunately the username is necessary in this
 implementation (as we do not want to rely on a database for remember-me
 services). High security applications should be aware of this occasionally undesired
 disclosure of a valid username.
 
 This is a basic remember-me implementation which is suitable for many
 applications. However, we recommend a database-based implementation if you
 require a more secure remember-me approach (see PersistentTokenBasedRememberMeServices).
 
 By default the tokens will be valid for 14 days from the last successful authentication attempt. This can be changed
 using AbstractRememberMeServices.setTokenValiditySeconds(int). If this value is less than zero, the expiryTime will remain at
 14 days, but the negative value will be used for the maxAge property of the cookie, meaning that it will
 not be stored when the browser is closed.
- Author:
- Ben Alex
 
 
 
| Method Summary | 
|  void | onLoginSuccess(javax.servlet.http.HttpServletRequest request,
               javax.servlet.http.HttpServletResponse response,
               org.springframework.security.core.Authentication successfulAuthentication)Called from loginSuccess when a remember-me login has been requested.
 | 
 
| Methods inherited from class egovframework.rfc3.iam.security.authentication.rememberme.AbstractRememberMeServices | 
| afterPropertiesSet, autoLogin, extractRememberMeCookie, getKey, getParameter, loginFail, loginSuccess, logout, onCookiesValidate, setAlwaysRemember, setAuthenticationDetailsSource, setCookieName, setKey, setParameter, setTokenValiditySeconds, setUserDetailsService, setUseSecureCookie | 
 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
TokenBasedRememberMeServices
public TokenBasedRememberMeServices()
onLoginSuccess
public void onLoginSuccess(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response,
                           org.springframework.security.core.Authentication successfulAuthentication)
- Description copied from class: AbstractRememberMeServices
- Called from loginSuccess when a remember-me login has been requested.
 Typically implemented by subclasses to set a remember-me cookie and potentially store a record
 of it if the implementation requires this.
 
- 
 
-