tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregg Bolinger" <gdbol...@embeddedthought.com>
Subject JDBCRealm
Date Fri, 01 Aug 2003 14:52:00 GMT
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: 
  _____  


<%@page 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
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message