This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Session Termination  RSS feed

 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for quick reply! I will try that and let u know abt result!
 
Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Idea! But is there any further better way of doing this?
Regards
Manohar
------------------
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!