gg_1234
gg_1234

Reputation: 117

Spring Session Remember Me

I have tried the spring session samples and it is really interesting.

i am trying to do the following , i am trying to plug spring session in the restful service where i want to different TTL for the session id's based on the request

For example, Client Consuming my restful service may have remember me Option On/OFF.

When remember me on i want to provide TTL as 90 days where as for the remember me off i want to set the TTL to 5 mins , how do we achieve this in spring session.

Also how do we manage(limiting) concurrent session for an user , is the concurrent session can be achieved by integrating with spring security or is the same capabilities provided in spring session.

Please suggest, any help is highly appreciated

Upvotes: 1

Views: 1755

Answers (1)

Rob Winch
Rob Winch

Reputation: 21720

This can be done by setting the HttpSession.setMaxInactiveInterval(int timeInSeconds). For example, after authenticating the user, you could do the following:

int someTime = getExpireBasedOnMyCriteria();
httpServletRequest.getSession().setMaxInactiveInterval(someTime);

Upvotes: 1

Related Questions