@ -19,13 +19,14 @@ In essence, a cookie is sent to the browser upon successful interactive authenti
@@ -19,13 +19,14 @@ In essence, a cookie is sent to the browser upon successful interactive authenti
username: As identifiable to the UserDetailsService
password: That matches the one in the retrieved UserDetails
expirationTime: The date and time when the remember-me token expires, expressed in milliseconds
key: A private key to prevent modification of the remember-me token
algorithmName: The algorithm used to generate and to verify the remember-me token signature
----
====
@ -113,6 +114,53 @@ A `key` is shared between this authentication provider and the `TokenBasedRememb
@@ -113,6 +114,53 @@ A `key` is shared between this authentication provider and the `TokenBasedRememb
In addition, `TokenBasedRememberMeServices` requires a `UserDetailsService`, from which it can retrieve the username and password for signature comparison purposes and generate the `RememberMeAuthenticationToken` to contain the correct `GrantedAuthority` instances.
`TokenBasedRememberMeServices` also implements Spring Security's `LogoutHandler` interface so that it can be used with `LogoutFilter` to have the cookie cleared automatically.
By default, this implementation uses the MD5 algorithm to encode the token signature.
To verify the token signature, the algorithm retrieved from `algorithmName` is parsed and used.
If no `algorithmName` is present, the default matching algorithm will be used, which is MD5.
You can specify different algorithms for signature encoding and for signature matching, this allows users to safely upgrade to a different encoding algorithm while still able to verify old ones if there is no `algorithmName` present.
To do that you can specify your customized `TokenBasedRememberMeServices` as a Bean and use it in the configuration.
@ -90,9 +108,9 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -90,9 +108,9 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@ -110,15 +128,27 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -110,15 +128,27 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
// only called once per HttpSession - if the token is valid, it will cause
// SecurityContextHolder population, whilst if invalid, will cause the cookie to
@ -130,17 +160,32 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -130,17 +160,32 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@ -172,15 +217,33 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -172,15 +217,33 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@ -190,7 +253,7 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -190,7 +253,7 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@ -234,4 +297,20 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
@@ -234,4 +297,20 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {