You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chetan Bob <ch...@gmail.com> on 2008/06/15 08:25:55 UTC
3 fiels form based login authentication in Tomcat
Hi
I want Tomcat authentication like company id / username / Password so it
looks i should go for Form based authentication ....
1) I wrote login.jsp and error.jsp ;
2)web.xml
<login-config>
<auth-method>FORM</auth-method>
<realm-name>MyFirst Protected Area</realm-name>
<form-login-config>
<form-login-page>/login.jsp<;/form-login-page>
<form-error-page>/error.jsp<;/form-error-page>
</form-login-config>
</login-config>
3 )configured Realm in server.xml of tomcat
className="org.apache.catalina.realm.DataSourceRealm";
Now issue is tomcat handles this j_security_check action and i want the
j_companyid field in my application ... so how can i get it ....
Can we write an class that will process this authentication and pass insted
of let tomcat handel it ?
OR
any configuration that can handel this j_companyid and pass on to
application....?
Should we need to write our own Realm if so ....then how to any example?
Thanks
Chetan
Login.jsp
*********************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h1>Login to MyFirst</h1>
<p>
If you have been issued a username and password, key them in here now!
</p>
<form method="POST" action="j_security_check">
CompanyID : <input type="text" size="15" maxlength="25"
name="j_companyid"><br><br>
Username : <input type="text" size="15" maxlength="25"
name="j_username"><br><br>
Password : <input type="password" size="15" maxlength="25"
name="j_password"><br><br>
<input value="Login" type="submit"> <input value="Clear" type="reset">
</form>
</body>
</html>
****************************************************
--
View this message in context: http://www.nabble.com/3-fiels-form-based-login-authentication-in-Tomcat-tp17846853p17846853.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 3 fiels form based login authentication in Tomcat
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chetan,
Chetan Bob wrote:
| I want Tomcat authentication like company id / username / Password so it
| looks i should go for Form based authentication ....
Tomcat cannot do this at all, unfortunately. Securityfilter
(http://securityfilter.sourceforge.net), if you get the development
version, will give you access to the raw HttpServletRequest and you can
grab whatever information you want (including additional fields).
| Should we need to write our own Realm if so ....then how to any example?
You can't even write your own realm, because Realm only includes methods
like:
authenticate(String username, String password)
so you're out of luck.
Check out sf. You'll be happy.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhWxZoACgkQ9CaO5/Lv0PAplQCfZ7pm0mh3mzSfFFD07pCsLshz
gvsAoKAXdxQfB9j2iSexUCrlWblBWGqK
=nxqg
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org