-1

What should i do in Spring Boot to activate persistent sessions ?

I tried to play with theses properties without luck:

server.session.persistent=true
server.session.store-dir=/some/path/sessions

When i stop the daemon a see a file SESSIONS.cer on the session store-dir which disappears when I restart the daemon, but the user not logged anymore (go to login page).

My Spring boot project is an Oauth2 authorization server (I use Spring Security Oauth2) which is used with the Implicit grant. The session is used to avoid the user the retype its credential (login form) when asking for a token (/oauth/authorize). This is the default behaviour of spring security oauth2

EDIT:

I tried with the following property too without luck:

server.tomcat.basedir=/tmp
sgt-hartman
  • 634
  • 6
  • 25

2 Answers2

0

To me, it didn't work because the objects i stored in session were not Serializable. Just check they are.

Gruik
  • 1
0

Object stored in session must implement Serializable along with a fixed serialVersionUID. Otherwise JVM will assign a random serialVersionUID which will be different for each server deployment. Since it is different for each deployment, server will not able to find a previous session and result in creating a new session.

Reference:

Why jvm generates serialVersionUID?

Sastrija
  • 3,284
  • 6
  • 47
  • 64