This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

3 fiels form based login authentication in Tomcat

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?


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>

****************************************************
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic