Extending the life of spring security remember me

2019-08-27 16:56发布

I am trying to implement the Spring Security remember me option my Java Spring MVC Web Application. The Spring version I use is 4.1.4 and the Spring Security version is 3.2.5.

I have tried to follow the documentation from the following URL https://www.baeldung.com/spring-security-remember-me

I have added the following entry in my spring-security.xml :

<!-- login remember me -->
  <remember-me key="myAppKey" token-validity-seconds="864000" />

In my login form, I have added the following entry:

<div class="form-group">
    <input type="checkbox" id="remember" name="_spring_security_remember_me" />
    <label for="remember">Remember Me</label>
</div>

I am now able to keep a user logged in if the remember me is checked. But I am trying to extend the cookie lifetime after each successful login. This way, a person remains logged in for two more weeks after his last successful login. Is there any way to achieve this?

0条回答
登录 后发表回答