Search code examples
spring-session

Is it possible to produce two session with one accout using spring session


I am using Spring-session-jdbc.

The demands are:

  • One account shared in PC web and rest API for APP.
  • When account login in PC web, the session max age is 30 mins.
  • When account login in APP, the session max age is 60 mins.
  • The session in PC web and APP does not have influence on each other.

I have not any idea about it .

Would you please give me some advice?

Thank you very much.


Solution

  • I got the solution.

    • dynamic set maxInactiveInterval in AuthenticationSuccessHandler implementation codes

    • using Spring-session multiple session that PC web do normal requests and APP rest API requests with _s=1 parameter , the APP rest API's jsessionid should be like 'SESSION:"1 xxxxxxxxxxxxxxx"'