I connect to Oracle, but mine's configured slightly different.

in the server.xml file,

        connectionName="user_name"
        connectionPassword="password"
        userTable="users" userNameCol="user_name" userCredCol="user_pass"
        userRoleTable="user_roles" roleNameCol="role_name"/>

I have an underscore between mine -- on the roleNameCol value. Does j_security 
check require that?


And are you also configuring this within the server.xml file as well as the 
web.xml file?

I'm running TC 4.1.3 and it requires it there, too...maybe not for your version.

Good luck!


-----Original Message-----
From: Wade Little [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 27, 2007 2:37 PM
To: users@tomcat.apache.org
Subject: j_security_check


I have tried all I can to setup Netbeans/Tomcat to use
postgre for my user auth via J_security_check by
talking with my Postgre DB....can anyone review the
following files and let me know if I have done
anything wrong.  I verified I can connect via a JSP
and return a result.  But I cant get the Auth to work.
 Here is what I used that works to talk to the DB:

<%
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5432/landt";
Connection con = DriverManager.getConnection(url,
"postgres", "postgres");
Statement stmt =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                    
ResultSet.CONCUR_READ_ONLY);
ResultSet srs = stmt.executeQuery("SELECT username
FROM users");
while (srs.next()) {
        String name = srs.getString("username");
        out.println(name);
        }
        %>






Web.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>
    <security-constraint>
        <display-name>TenantConstraint</display-name>
        <web-resource-collection>
           
<web-resource-name>tenant</web-resource-name>
            <description>Tenant</description>
            <url-pattern>/secureTenant/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>tenant</role-name>
            </auth-constraint>
        </security-constraint>
    <security-constraint>
       
<display-name>LandlordConstraint</display-name>
        <web-resource-collection>
           
<web-resource-name>landlord</web-resource-name>
            <description>Landlord</description>
           
<url-pattern>/secureLandlord/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>landlord</role-name>
            </auth-constraint>
        </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <Realm
className="org.apache.catalina.realm.JDBCRealm"
connectionName="postgres"
connectionPassword="postgres"
connectionURL="jdbc:postgresql://localhost:5432/landt"
debug="99" driverName="org.postgresql.Driver"
roleNameCol="rolename" userCredCol="password"
userNameCol="username" userRoleTable="user_roles"
userTable="users"/>
        <form-login-config>
           
<form-login-page>/login.jsp</form-login-page>
           
<form-error-page>/error.html</form-error-page>
            </form-login-config>
        </login-config>
    <security-role>
        <description>For Tenants</description>
        <role-name>tenant</role-name>
    </security-role>
    <security-role>
        <description>For Landlords</description>
        <role-name>landlord</role-name>
    </security-role>
    </web-app>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to