You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SpringSession with ChangeSessionIdAuthenticationStrategy the SessionRepositoryFilter's method, changeSessionId, is invoked. In this code the session variable and the original variable are a reference to the same object, so in the following code extracted from SessionRepositoryFilter.changeSessionId
in the second line we are effectively overwriting the internal session object of the same HttpSessionWrapper, referenced by our original AND session variables.
So in the third line we have lost the reference to the previously stored maxInactiveInterval value
The solution is as simply as
HttpSessionWrapper newSession = getSession(); int previousValue = session.getMaxInactiveInterval();
original.setSession(newSession.getSession());
newSession.setMaxInactiveInterval(previousValue);
The text was updated successfully, but these errors were encountered:
Yes, this looks like a bug affecting 1.3.x branch. As you noted yourself, the master i.e. 2.0.x isn't affected due to HttpServletRequest#changeSessionId being fully implemented in #835.
vpavic
changed the title
SessionRepositoryFilter's method, changeSessionId, does not copy the previous maxInactiveInterval into the new session
SessionRepositoryFilter#changeSessionId does not copy the previous maxInactiveInterval into the new session
Feb 12, 2018
When using SpringSession with ChangeSessionIdAuthenticationStrategy the SessionRepositoryFilter's method, changeSessionId, is invoked. In this code the session variable and the original variable are a reference to the same object, so in the following code extracted from SessionRepositoryFilter.changeSessionId
HttpSessionWrapper newSession = getSession();
original.setSession(newSession.getSession());
newSession.setMaxInactiveInterval(session.getMaxInactiveInterval());
in the second line we are effectively overwriting the internal session object of the same HttpSessionWrapper, referenced by our original AND session variables.
So in the third line we have lost the reference to the previously stored maxInactiveInterval value
The solution is as simply as
HttpSessionWrapper newSession = getSession();
int previousValue = session.getMaxInactiveInterval();
original.setSession(newSession.getSession());
newSession.setMaxInactiveInterval(previousValue);
The text was updated successfully, but these errors were encountered: