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 Tomcat and the fly likes Logging into a tomcat applications from an external form 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 » Products » Tomcat
Bookmark "Logging into a tomcat applications from an external form" Watch "Logging into a tomcat applications from an external form" New topic
Author

Logging into a tomcat applications from an external form

Allan Christensen
Greenhorn

Joined: Oct 21, 2003
Posts: 24
I've recently created a Tomcat application using the forms security of the web container. However, I would like it to be possible to log-in to the application from an external web page. Ie. I have the tomcat application running on a host that only runs Java applications - and I have another application running on a host that only runs PHP and Python applications. I would like to create a form in one of the PHP applications that will login to the tomcat application.

What I've tried so far is this:



The problem with that is that after it has acknowledge that the user name and password is correct it tries to look for j_security_check which obviously is not a file.

Not really sure what to do about it. Anybody have any suggestions?

Kind regards,
Allan
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
I think, you can't do that because "j_security_check" is not name of servlet mapping but this name shoule be trigger Server done in security.

But i'm not sure .


So, you can config that follow this ::

Basic and Form-based Authorization Configuration


Finally : please post your response ...


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Allan Christensen
Greenhorn

Joined: Oct 21, 2003
Posts: 24
The tomcat application works fine with security (just like the link you pasted) as it as. The problem is allowing external forms to log in.

It actually seems like it authenticates the user with the code that I pasted in my first post, the problem is that after the authentication it starts looking for the file j_security_check - maybe I should try to create a jsp file called j_security_check that automatically re-routes the user back to the default page.
Allan Christensen
Greenhorn

Joined: Oct 21, 2003
Posts: 24
I actually got this thing working now. My only concern now is people who have disabled cookies in their browser - but that I can live with.

What I did was to use the form from my first post and then add the following mapping to my deployment descriptor:



which will redirect requests for j_security_check to the main servlet.

Pretty nice! :-)

Anyways, if anyone have any comments on this (if it should be avoided, if it is bad practice,etc) please go ahead and post.

Kind regards,
Allan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logging into a tomcat applications from an external form
 
Similar Threads
redirecting to the last requested page after valid log in
forms authentication (j_security_check) with JSF
3 fiels form based login authentication in Tomcat
JDBCRealm and Form Login
Role management