Results 1 to 1 of 1
Thread: servlet secure login
- 11-07-2009, 02:04 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 50
- Rep Power
- 0
servlet secure login
Hi i am confused about setting up a loginpage using servlets...
original design...
simple html form which redirects to servlet, which tests user name and password
against a database and redirects accordingly... works fine
however, upon further reading i discovered role based authentication, and
the inbuilt servlet security features.. here is the web.xml
Java Code:<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>servletSecurity</display-name><description>login forms</description> <security-constraint> <web-resource-collection> <web-resource-name>Test</web-resource-name> <url-pattern>/LoginForm.html</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>manager</role-name></auth-constraint> <user-data-constraint> <transport-guarantee>NONE</transport-guarantee> </user-data-constraint> </security-constraint><login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/LoginForm.html</form-login-page> <form-error-page>/LoginErr.html</form-error-page> </form-login-config></login-config> <servlet> <description></description> <display-name>logInCheck</display-name> <servlet-name>logInCheck</servlet-name> <servlet-class>logInCheck</servlet-class> </servlet> <servlet-mapping> <servlet-name>ApageMaker</servlet-name> <url-pattern>/ApageMaker</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> <welcome-file>LoginForm.html</welcome-file> </welcome-file-list> </web-app>
now in the first version i had
which redirected the results ( usrname and password) to a servlet which queries the database and then redirects...Java Code:<FORM ACTION="http://www.working_url.com/servlet/logIn" method="POST"..
BUT, when i use this method i use
which i assume calls some inherited class to get processed ? as it redirectsJava Code:<form action="j_security_check">
already to the loginErr.html page...
but how do i process my own username/password list ?
and how do redirect to the login processing servlet loginCheck.java
here's the html of the new login page that corresponds the web.xml...
any help would be appreciated ..Java Code:<form action="j_security_check"> <h1 align="center"></br> Login </h1> <center> <table border ="0"> <tr> <td ><h3>user name</br></h3></td> <td> <input type="text" name = "j_username"> </td> </tr> <tr> <td><h3>password</h3></td> <td> <input type="password" name = "j_password"> </td> </tr> </table> <input type ="submit" value = "Login!"> </center>
thanks
simo_mon
Similar Threads
-
How Java is so secure than other?
By makpandian in forum New To JavaReplies: 4Last Post: 06-26-2009, 04:22 AM -
cannot open database requested in login. Login fails
By banduskank in forum JDBCReplies: 0Last Post: 06-25-2008, 12:41 PM -
Secure FTP Wrapper 3.0.2
By Java Tip in forum Java SoftwareReplies: 0Last Post: 04-29-2008, 06:05 PM -
Secure FTP Applet 4.4
By vglass in forum Java SoftwareReplies: 0Last Post: 11-13-2007, 06:30 PM -
Secure FTP Factory 7.0
By vglass in forum Java SoftwareReplies: 0Last Post: 07-20-2007, 01:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks