Hi,

I'm having a problem with the JDBCRealm example in JDBCRealm.howto. It
almost seems to be woking fine but I keep getting the error page instead of
the requested URL. Here is the output from tomcat:

2001-03-17 09:26:46 - ContextManager: JDBCRealm: JDBCRealm.authenticate:
SELECT user_pass FROM users WHERE user_name = ?
2001-03-17 09:26:46 - ContextManager: JDBCRealm: Authentication unsuccessful
for  user null
2001-03-17 09:27:16 - ContextManager: JDBCRealm: Authentication successful
for user bbean
2001-03-17 09:27:16 - ContextManager: JDBCRealm: Auth ok, user=bbean

Does this mean that I've succussfully authenticated and if so how come it
keeps returning the error page? The following is how I have things set up:

server.xml
------------------------------------------
<RequestInterceptor className="org.apache.tomcat.request.JDBCRealm"
debug="99"
     driverName="org.gjt.mm.mysql.Driver"
 
connectionURL="jdbc:mysql://localhost/authority?user=test;password=test"
     userTable="users" userNameCol="user_name" userCredCol="user_pass"
     userRoleTable="user_roles" roleNameCol="role_name" />

web.xml
-------------------------------------------
    <security-constraint>
      <web-resource-collection>
         <web-resource-name>Administration Area</web-resource-name>
         <url-pattern>/jsp/admin/protected/*</url-pattern>
         <http-method>POST</http-method>
         <http-method>PUT</http-method>
      </web-resource-collection>
      <auth-constraint>
         <role-name>adminRole</role-name>
      </auth-constraint>
    </security-constraint>
    <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>MTRG Administration Authentication Area</realm-name>
      <form-login-config>
        <form-login-page>/jsp/admin/login/login.jsp</form-login-page>
        <form-error-page>/jsp/admin/login/error.jsp</form-error-page>
      </form-login-config>
    </login-config>

MySql tables [authority]
--------------------------------------------

mysql> select * from users;
+-----------+-----------+
| user_name | user_pass |
+-----------+-----------+
| test      | test      |
| tomcat    | tomcat    |
| bbean     | password  | 
| sbeck     | password  |
+-----------+-----------+

mysql> select * from user_roles;
+-----------+------------+
| user_name | role_name  |
+-----------+------------+
| bbean     | adminRole  |
| sbeck     | userRole   |
| test      | tomcatRole |
| tomcat    | tomcatRole |
+-----------+------------+

mysql> select * from roles;
+------------+
| role_name  |
+------------+
| adminRole  |
| tomcatRole |
| userRole   |
+------------+

Many thanks to you in advance!

Bryon Bean
[EMAIL PROTECTED]

Reply via email to