wood burning stoves 2.0*
The moose likes Servlets and the fly likes Auto Login with Container Managed Security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Auto Login with Container Managed Security" Watch "Auto Login with Container Managed Security" New topic
Author

Auto Login with Container Managed Security

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
Some sites would store the user credential in cookie so that by sending the stored cookie, the user doesn't have to login again the next time. Javaranch and many BBS sites are examples. But, how can I implement such a feature if I also want to use container managed authentication?
Durgaprasad
Greenhorn

Joined: Oct 02, 2006
Posts: 17
I assume you are using HttpRequest, HttpResponse in your service method.

use the following code


to create a new cookie and store it in the client machine.

the life time of the cookie on the server machine depends on the age you set



I hope this will help you

scjp 91
scwcd perparing
Isdx preparing
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
Thanks Durgaprasad,

But the point is how could I trigger the container's authentication mechanism by using cookies? Normally, I need to request a constrained page before being forwarded to the login page defined in web.xml and I have to post to j_security_check with proper j_username & j_password parameters. All these can't be invoked by cookies.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Durgaprasad,
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
jQuery in Action, 2nd edition
 
subject: Auto Login with Container Managed Security
 
Similar Threads
Auto Login
is there any way besides cookie to keep user info?
advice needed on login page
How to draw login sequence diagram if I use container managed Security?
Only [auth-method] FORM use session tracking ?