On 20/05/2008 15:04, Mark Thomas wrote the following:
Carol Cheung wrote:
Hi,

I am very new to the aforementioned subject. As hinted in subject, I am trying to set up a web application using form authentication.

I have set up server.xml according to the steps specified at
http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html
for JDBCRealm

For the application, I have followed the instructions at
http://www.onjava.com/pub/a/onjava/2001/08/06/webform.html

The problem I am experiencing is that when I try to access the page I have specified in web.xml as secure, I get to that page - I am not redirected to the login page that I specified in web.xml.

I've had someone else look at web.xml and they say that's not where the problem lies. So I'm wondering if the problem is with server.xml.

Can anyone give a newbie some pointers as to where to look to diagnose and fix this problem?

Thank you in advance for your help.

You'll need to post the relevant sections of your web.xml, your server.xml and the URL of the protected resource. If you don't see the login form an error in web.xml is most likely.

Mark


Hi,

Here's a part of my web.xml:

 <security-role>
   <description>user</description>
   <role-name>user</role-name>
 </security-role>

  <!-- Login Authentication -->
  <security-constraint>
    <display-name>Secure User Pages</display-name>
    <web-resource-collection>
      <web-resource-name>SecureUserPages</web-resource-name>
      <url-pattern>/index.jsp</url-pattern>
      <url-pattern>/welcome.jsp</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <description>user</description>
        <role-name>user</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/loginError.jsp</form-error-page>
    </form-login-config>
  </login-config>

Inside the Engine element of server.xml, I have:

      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="org.postgresql.Driver"
      connectionURL="jdbc:postgresql://localhost:5432/thedb?user=theuser
&amp;password=thepw"
                 digest="MD5"
userTable="users" userNameCol="username" userCredCol="password"
          userRoleTable="user_roles" roleNameCol="rolename" />

The Connector element in server.xml:
<Connector port="8888"
...

The URL is
http://hostname:8888/appname/jsp/welcome.jsp

(For reasons of confidentiality, I had to replace the name of the database with "thedb", user with "theuser", password with "thepw", host with "hostname", application name with "appname" before posting. Please let me know if this poses a problem.)

Thanks in advance,
CC

---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to