aspose file tools*
The moose likes Servlets and the fly likes Session Termination Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Termination" Watch "Session Termination" New topic
Author

Session Termination

Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Hai!
Here is my problem! I have a session running between client(User) and Server. An user with admin rights can able to terminate that session from some other application running in same server.(Same as in Timeout of session but should whenever admin runs that aplication).
ASAP!
Thanks in Advance.
From
Manohar
Ashutosh Uprety
Ranch Hand

Joined: Nov 30, 2000
Posts: 39
If all u want to do is to give a "can log out anyone" permission to administrator, then here is what u can do ...
1. create a temp table with userId, jsessionid,usertype(admin or normal)
2. whenever anyone logs in then populate temp table with above info.
3. allow the admin to view whoever is logged on, by showing a list of users in the temp table.
4. allow him to delete any record from this temp table
5. for every agent user, before entering any page, check if the session is available in the temp table. If jsessionid is not available, then log him out.
gotcha !!
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Thanks for quick reply! I will try that and let u know abt result!
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Good Idea! But is there any further better way of doing this?
Regards
Manohar
------------------
Vels Manian
Greenhorn

Joined: Jun 28, 2001
Posts: 22
hi,
Try whether this can be used.
For the admin user get the SessionContext and display all the users details logged in and allow him to delete the session.
You can parse through the sessions and find the session info.
bye
vels

[This message has been edited by Vels Manian (edited July 17, 2001).]
Vels Manian
Greenhorn

Joined: Jun 28, 2001
Posts: 22
hi,
Here is the code u asked for.

HttpSession session = request.getSession(true);
HttpSessionContext contxt = session.getSessionContext();
Enumeration enum = contxt.getIds();

HttpSession session1;
while(enum.hasMoreElements())
{
session1 = contxt.getSession((String)enum.nextElement());
if(check for validitity of the session)
session1.invalidate();
}
hope this helps u
tc
vels
Raghav Sam
Ranch Hand

Joined: Apr 12, 2001
Posts: 412
Originally posted by Vels Manian:
hi,
Here is the code u asked for.

HttpSession session = request.getSession(true);
HttpSessionContext contxt = session.getSessionContext();
Enumeration enum = contxt.getIds();

HttpSession session1;
while(enum.hasMoreElements())
{
session1 = contxt.getSession((String)enum.nextElement());
if(check for validitity of the session)
session1.invalidate();
}
hope this helps u
tc
vels

But be warned, HttpSessionContext is deprecated for security reasons.
------------------
Raghav.


Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.<br />- Dr. Seuss
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Termination
 
Similar Threads
JVM For Managed Server
JRun Servlet Engine Problem
Issue in session manegement
Security issue
weblogic startup