You don't have a 'roles' table in your database.  'User_roles' is a link
entity between 'user' and 'roles'...  In this tables you should specify all
possible roles.  Check the unofficial FAQ, or the apache site.



-----Original Message-----
From: Gregg Bolinger [mailto:[EMAIL PROTECTED] 
Sent: 01 August 2003 19:36
To: 'Tomcat Users List'
Subject: RE: JDBCRealm

FYI - I removed the REALM entry for the Database user lookup and used
the tomcat-users.xml file and it works fine.  It only fails when I have
the REALM entry.  But I still don't know why it is not working right.

Gregg

-----Original Message-----
From: Gregg Bolinger [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 01, 2003 9:52 AM
To: [EMAIL PROTECTED]
Subject: JDBCRealm

I have been struggling trying to get this to work and I can't tell if I
am doing something wrong, or leaving something out, or what. Below is
all my code, then I will say what is happening: 
server.xml (relivant snippit) 
code: 
  _____  


<Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
        driverName="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost/holocron"
        connectionName="gdboling" connectionPassword="bolinger"
        userTable="users" 
        userNameCol="Username" 
        userCredCol="Password"
        userRoleTable="user_roles" 
        roleNameCol="Role" />
  _____  

web.xml (relivant snippit) 
code: 
  _____  


<security-constraint>
<web-resource-collection>
  <web-resource-name>SecurePages</web-resource-name>
  <description>Security constraint /secure</description>
  <url-pattern>/secure/*</url-pattern>
  <http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint> 
  <role-name>admin</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>/login.jsp</form-login-page>
    <form-error-page>/loginerror.jsp</form-error-page>
  </form-login-config>
</login-config>
<security-role>
    <role-name>admin</role-name>
</security-role>
  _____  

login.jsp 
code: 
  _____  


<[EMAIL PROTECTED] contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<form action='j_security_check' method="POST">
<TABLE>
    <TR>
        <TD>
            UserName
        </TD>
        <TD>
            <INPUT type='text' name='j_username' value=''>
        </TD>
    </TR>
    <TR>
        <TD>
            Password
        </TD>
        <TD>
            <INPUT type='password' name='j_password' value=''>
            <INPUT type='submit' name='submit' value='submit'>
        </TD>
    </TR>
</TABLE>
</body>
</html>
  _____  

And my database has 2 tables 
users
Username
Password 
user_roles
Username
Role 
---------------------------------------------------------
Now, I have a page in a folder called secure called AddReference.jsp.
When I try and access this page, I do get redirected to login.jsp. I
enter my username and password that I have stored in the database and
after clicking submit, I am taken to my loginerror.jsp page. I should be
redirected back to AddReference.jsp. I am entering the correct username
and password as I only have one entry. I get no compilation errors or
Tomcat errors when loading or stopping. 
If anyone has some insight to my problem, I would be greatly
appreciated. 
Thanks
Gregg Bolinger
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to