harmeet singh bawa

Greenhorn
+ Follow
since Dec 16, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by harmeet singh bawa

Thanks guys. I was able to take it a step further. this is where I stand now. I have tomcat 4.1 running on a windows machine with my app using forms based authentication in tomcat. I created an html page that I placed on my drive outside of the context of my app in tomcat.

<html>
<head>
<title>Please Log In</title>
</head>
<body>
<iframe src="http://localhost:8090/wwxchange" width="300" height="150">
</iframe>
</body>
</html>

With the use of an iframe I was able to accomplish what I wanted initially, but only partially. This is redirecting to my PreLogin.jsp page that I posed before and it all works good. Next step, I tried placing this html page on another machine in the network and in that case tomcat exhibits a strange behavior where it fails to login on the first attempt. Instead it redirects back to the PreLogin.jsp page asking for the login again. It almost behaves like tomcat is not able to authenticate the user this way. But when I dont do anything and just click on to login with the sme credentials I proveded before, it logs in successfully.

One change I made to the PreLogin.jsp page:
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' target='_new'>

Tried to open the app in a new window apart from the html page.

Is there something I am missing out here?

Thanks again.
8 years ago
I am following the Tomcat forms based authentication and I it is working for me through an external PreLogin.jsp page I have.

PreLogin.jsp:
<html>
<head><title>Please Log In</title>
<body>
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
<table border="0" cellspacing="5">
<tr>
<th align="right">Username:</th>
<td align="left"><input type="text" name="j_username"></td>
</tr>
<tr>
<th align="right">Password:</th>
<td align="left"><input type="password" name="j_password"></td>
</tr>
<tr>
<td align="right"><input type="submit" value="Log In"></td>
<td align="left"><input type="reset"></td>
</tr>
</table>
</form>
</body>
</html>


changes to web.xml:
...
...
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Worldwide Express</realm-name>
<form-login-config>
<form-login-page>/PreLogin.jsp</form-login-page>
<form-error-page>/LoginErr.jsp</form-error-page>
</form-login-config>
</login-config>
...
...

What is not working for me: I want to be able to have an external page outside of my applications context where I can take the login info (username and password) and using that login to tomcat. Can anyone please tell me if this is possible?

Thanks in advance.
8 years ago