This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes call j_security_check from within a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "call j_security_check from within a servlet" Watch "call j_security_check from within a servlet" New topic
Author

call j_security_check from within a servlet

Jean-Claude Rouvinez
Ranch Hand

Joined: Aug 26, 2003
Posts: 35
Hi,
We are using the container managed authentication of TOMCAT
(Apache Tomcat 5.5.9, please see http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#JAASRealm).

In some cases we want to perform an "automatic login" and so replace the login page by a servlet. This servlet should call j_security_check with the right parameters (j_username, j_password).

Is that possible?
If yes, could anybody post an example of the code?

Thank you for your help
[ November 02, 2006: Message edited by: Jean-Claude Rouvinez ]

Jean-Claude
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I have never see this done in a platform neutral way, but typically you do not access the j_security_check, you just call a 'login module' on the server side and pass the credentials. I'm not sure how to do it in Tomcat, but in Websphere you use the SSOAuthenticator
Jean-Claude Rouvinez
Ranch Hand

Joined: Aug 26, 2003
Posts: 35
(Reply to David O'Meara)
You are right. We did it in that way.

The problem is when a user has just registered. In that case we don't want him to go to the login screen and type his password again. After the registration the user is directly forwarded to the protected area. Therefore our idea was to simulate the login screen with a servlet.
 
 
subject: call j_security_check from within a servlet
 
Similar Threads
Configure Tomcat for Kerberos
JAAS Realm-Error
Integrate JAAS with JSP and Servlets
JAAS implementaion for web application with tomcat
JAAS