How to implement authentication?

Hi,

I have a servlet name Financial and I want to restrict user from accessing this servelet and all of its coresponding jsp pages. I did put a security constraint to web.xml but what I receive is an error saying that the login page(directed by the container) does not exist! Here is what I have in my web.xml

...(more servlet definitions)

<security-constraint>

<display-name>Financial</display-name>

<web-resource-collection>

<web-resource-name>Financial</web-resource-name>

<description>Restrict access to fiancial servlet</description>

<url-pattern>/Financial</url-pattern>

<url-pattern>/Financial/*</url-pattern>

<http-method>GET</http-method>

<http-method>POST</http-method>

<http-method>HEAD</http-method>

<http-method>PUT</http-method>

<http-method>OPTIONS</http-method>

<http-method>TRACE</http-method>

<http-method>DELETE</http-method>

</web-resource-collection>

<auth-constraint>

<role-name>Admin</role-name>

<role-name>Member</role-name>

</auth-constraint>

</security-constraint>

<login-config>

<auth-method>FORM</auth-method>

<realm-name/>

<form-login-config>

<form-login-page>/WEB-INF/docs/authentication/login.html</form-login-page>

<form-error-page>/WEB-INF/docs/authentication/failure.html</form-error-page>

</form-login-config>

</login-config>

<security-role>

<description>User who has been register</description>

<role-name>Member</role-name>

</security-role>

-

In addition, how can i use database /ldap server to perform username,pass,role lookup instead of the tomcat-user.xml by default?

Hope to get some help

Thai

[2076 byte] By [lnthai2002a] at [2007-11-27 7:04:23]
# 1
Actually, when I change the extenstion of login.html to login.jsp and add the <@page> directive, the login page is displayed correctly! So another the question is why cant i use html but jsp?
lnthai2002a at 2007-7-12 18:55:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
From what I can see, your files shouldn't be in the WEB-INF folder since that is not part of the application that is available online.Try shifting the html files to your application folder, one level up from the WEB-INF and I think you'll see it'll start working.
nogoodatcodinga at 2007-7-12 18:55:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

I moved them to /Web Pages but i still got the same error. Doesnt seem that the container found the html pages.

I have test if my servelet can actually rend a request to an html as follow:

//inside a servlet:

String dest = "/WEB-INF/docs/test.html";

try

{request.getRequestDispatcher(dest).forward(request, response); }

catch(Throwable t)

{getServletContext().log(t.getMessage());}

After 1 minutes, this is what i got from the log:

The server side component of the HTTP Monitor has detected a java.lang.StackOverflowError.

This happens when there is an infinite loop in the web module.

Correct the cause of the infinite loop before running the web module again.

What's going on?

lnthai2002a at 2007-7-12 18:55:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Like I said, you can't access WEB-INF, it's just not published with the app. Try accessing the HTML files from your other folder.
nogoodatcodinga at 2007-7-12 18:55:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...