Hello,
I am having an issue setting up a FORM realm in Tomcat 5.5.27.  It does not
seem to be blocking access to protected resources for some reason, and I
cannot figure out why.  If I access index.jsp, which is supposed to be
protected, the server just sends me to the index.jsp page.  It does this for
every other page as well.  It does not prompt me to login first, or block
access to protected resources.

I disabled the memory realm as well as created the correct db tables.  The
issue has something to do with the Realm not being activated.  I undeployed,
redeployed and rebuilt the app several times, and it still does not work.
It's strange because the app starts fine and I don't get any errors.  The
realm just doesn't protect anything.  Please give me some ideas or
something, on how to resolve this issue.

Thanks.

Here is my app info:

-------------------------------------- web.xml
-------------------------------------------------
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected Area</web-resource-name>
            <url-pattern>/MyApp/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>user</role-name>
        </auth-constraint>
    </security-constraint>

    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>MyApp REALM</realm-name>
        <form-login-config>
            <form-login-page>/MyApp/login.jsp</form-login-page>
            <form-error-page>/MyApp/error.jsp</form-error-page>
        </form-login-config>
    </login-config>


-------------------------------------------------------- login.jsp
-------------------------------------------------

<form action=<%= response.encodeURL("j_security_check") %> method="get">
            <fieldset>
                <legend>User Login</legend>
                <p><label>Username: </label><input type="text"
name="j_username"/></p>
                <p><label>Password: </label><input type="password"
name="j_password"/></p>
                <p class="submit"><input type="submit" value="Login"/></p>
            </fieldset>
        </form>

------------------------------------------------------------ server.xml
------------------------------------------------------------

<Realm  className="org.apache.catalina.realm.JDBCRealm"
             driverName="org.gjt.mm.mysql.Driver"
          connectionURL="jdbc:mysql://localhost/test_db"
         connectionName="tester" connectionPassword="test"
              userTable="users" userNameCol="user_name"
userCredCol="user_password"
          userRoleTable="user_roles" roleNameCol="role_name" />

-- 
Scott
www.HikeHaven.com
Never under estimate the wisdom of nature!!!

Reply via email to