You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gregg Bolinger <gd...@embeddedthought.com> on 2003/08/01 16:52:00 UTC
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:
_____
<%@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
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
I would if the damn thing wasn't so busy. All I get are 503's!!!!! We
need to hurry up and get that hardware upgraded. :)
Gregg
-----Original Message-----
From: Mike Curwen [mailto:gb_dev@gb-im.com]
Sent: Friday, August 01, 2003 2:20 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
*bash* ;)
Gonna go back to the 'ranch now Gregg ? hehe.
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 2:08 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
>
> Ok, I figured out my STUPID problem. I was giving the wrong
> table name to the REALM element for my user_roles table.
> Please, everyone bash me on the head. I deserve it. LOL
>
> Thanks for the help anyway.
>
> Gregg
>
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 1:55 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> Actually, I do have a roles table with a column named Role
> and I have my roles listed there. Is there anywhere in the
> realm config I need to specify this table. Because in the
> docs it only specifies the user table and the user roles
> table both of wich have 2 columns in each.
>
> Thanks.
>
> -----Original Message-----
> From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
> Sent: Friday, August 01, 2003 1:48 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> 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:gdboling@embeddedthought.com]
> 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:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 9:52 AM
> To: tomcat-user@jakarta.apache.org
> 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:
> _____
>
>
> <%@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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
I would if the damn thing wasn't so busy. All I get are 503's!!!!! We
need to hurry up and get that hardware upgraded. :)
Gregg
-----Original Message-----
From: Mike Curwen [mailto:gb_dev@gb-im.com]
Sent: Friday, August 01, 2003 2:20 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
*bash* ;)
Gonna go back to the 'ranch now Gregg ? hehe.
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 2:08 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
>
> Ok, I figured out my STUPID problem. I was giving the wrong
> table name to the REALM element for my user_roles table.
> Please, everyone bash me on the head. I deserve it. LOL
>
> Thanks for the help anyway.
>
> Gregg
>
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 1:55 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> Actually, I do have a roles table with a column named Role
> and I have my roles listed there. Is there anywhere in the
> realm config I need to specify this table. Because in the
> docs it only specifies the user table and the user roles
> table both of wich have 2 columns in each.
>
> Thanks.
>
> -----Original Message-----
> From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
> Sent: Friday, August 01, 2003 1:48 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> 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:gdboling@embeddedthought.com]
> 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:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 9:52 AM
> To: tomcat-user@jakarta.apache.org
> 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:
> _____
>
>
> <%@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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Mike Curwen <gb...@gb-im.com>.
*bash* ;)
Gonna go back to the 'ranch now Gregg ? hehe.
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 2:08 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
>
> Ok, I figured out my STUPID problem. I was giving the wrong
> table name to the REALM element for my user_roles table.
> Please, everyone bash me on the head. I deserve it. LOL
>
> Thanks for the help anyway.
>
> Gregg
>
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 1:55 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> Actually, I do have a roles table with a column named Role
> and I have my roles listed there. Is there anywhere in the
> realm config I need to specify this table. Because in the
> docs it only specifies the user table and the user roles
> table both of wich have 2 columns in each.
>
> Thanks.
>
> -----Original Message-----
> From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
> Sent: Friday, August 01, 2003 1:48 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> 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:gdboling@embeddedthought.com]
> 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:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 9:52 AM
> To: tomcat-user@jakarta.apache.org
> 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:
> _____
>
>
> <%@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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Mike Curwen <gb...@gb-im.com>.
*bash* ;)
Gonna go back to the 'ranch now Gregg ? hehe.
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 2:08 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
>
> Ok, I figured out my STUPID problem. I was giving the wrong
> table name to the REALM element for my user_roles table.
> Please, everyone bash me on the head. I deserve it. LOL
>
> Thanks for the help anyway.
>
> Gregg
>
> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 1:55 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> Actually, I do have a roles table with a column named Role
> and I have my roles listed there. Is there anywhere in the
> realm config I need to specify this table. Because in the
> docs it only specifies the user table and the user roles
> table both of wich have 2 columns in each.
>
> Thanks.
>
> -----Original Message-----
> From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
> Sent: Friday, August 01, 2003 1:48 PM
> To: 'Tomcat Users List'
> Subject: RE: JDBCRealm
>
> 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:gdboling@embeddedthought.com]
> 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:gdboling@embeddedthought.com]
> Sent: Friday, August 01, 2003 9:52 AM
> To: tomcat-user@jakarta.apache.org
> 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:
> _____
>
>
> <%@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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
Ok, I figured out my STUPID problem. I was giving the wrong table name
to the REALM element for my user_roles table. Please, everyone bash me
on the head. I deserve it. LOL
Thanks for the help anyway.
Gregg
-----Original Message-----
From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 1:55 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
Actually, I do have a roles table with a column named Role and I have my
roles listed there. Is there anywhere in the realm config I need to
specify this table. Because in the docs it only specifies the user
table and the user roles table both of wich have 2 columns in each.
Thanks.
-----Original Message-----
From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
Sent: Friday, August 01, 2003 1:48 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
Ok, I figured out my STUPID problem. I was giving the wrong table name
to the REALM element for my user_roles table. Please, everyone bash me
on the head. I deserve it. LOL
Thanks for the help anyway.
Gregg
-----Original Message-----
From: Gregg Bolinger [mailto:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 1:55 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
Actually, I do have a roles table with a column named Role and I have my
roles listed there. Is there anywhere in the realm config I need to
specify this table. Because in the docs it only specifies the user
table and the user roles table both of wich have 2 columns in each.
Thanks.
-----Original Message-----
From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
Sent: Friday, August 01, 2003 1:48 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
Actually, I do have a roles table with a column named Role and I have my
roles listed there. Is there anywhere in the realm config I need to
specify this table. Because in the docs it only specifies the user
table and the user roles table both of wich have 2 columns in each.
Thanks.
-----Original Message-----
From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
Sent: Friday, August 01, 2003 1:48 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
Actually, I do have a roles table with a column named Role and I have my
roles listed there. Is there anywhere in the realm config I need to
specify this table. Because in the docs it only specifies the user
table and the user roles table both of wich have 2 columns in each.
Thanks.
-----Original Message-----
From: Stuart MacPherson [mailto:aprw00@dsl.pipex.com]
Sent: Friday, August 01, 2003 1:48 PM
To: 'Tomcat Users List'
Subject: RE: JDBCRealm
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Stuart MacPherson <ap...@dsl.pipex.com>.
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Stuart MacPherson <ap...@dsl.pipex.com>.
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:gdboling@embeddedthought.com]
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: JDBCRealm
Posted by Gregg Bolinger <gd...@embeddedthought.com>.
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:gdboling@embeddedthought.com]
Sent: Friday, August 01, 2003 9:52 AM
To: tomcat-user@jakarta.apache.org
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:
_____
<%@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