Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different session timeouts for different users in same web app

I have a requirement within the same web application to set 2 session timeouts.

60 minutes for regular users and 3 hours for admin users.

I am told this is not possible and I will need to host a separate web app for the admins.

Is there any workaround?

UPDATE: Thanks to Bozho and Kurt's replies - I have a followup question.

Does session.setMaxInactiveInterval() override the value of session timeout set via web.xml ?

like image 711
shinynewbike Avatar asked Aug 05 '10 11:08

shinynewbike


People also ask

Is a method to set the timeout for a session individually?

Setting Session timeout − You can call the public void setMaxInactiveInterval(int interval) method to set the timeout for a session individually. Log the user out − The servers that support servlets 2.4, you can call logout to log the client out of the Web server and invalidate all sessions belonging to all the users.

How do I manage session timeout?

Click Servers > Server Type > WebSphere Application Servers > WebSphere Portal. Click Container Settings > Session management > Set Timeout. Enter the desired timeout value in minutes.

What is session timeout in web application?

Session timeout represents the event occuring when a user does not perform any action on a web site during an interval (defined by a web server). The event, on the server side, changes the status of the user session to 'invalid' (ie.


2 Answers

You can try session.setMaxInactiveInterval(int interval)

like image 75
Bozho Avatar answered Sep 19 '22 15:09

Bozho


When I look at the HttpSession interface, I see the following method.

setMaxInactiveInterval(int interval): Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.

like image 42
Kurt Du Bois Avatar answered Sep 18 '22 15:09

Kurt Du Bois