• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Auto Login with Container Managed Security

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic