ok, I swore I wasn't going to bother you guys again on the weekend, but I am
running into a little quirk here.  I'm running 6.0.29.  Here is my webapp's
context.xml:
<?xml version='1.0' encoding='utf-8'?>
<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Resource
        name="jdbc/RealmDB" auth="Container" type="javax.sql.DataSource"
        username="root" password="password"
driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/gamedatabase"
        maxActive="-1" maxIdle="5" maxWait="5000"
        removeAbandoned="true" removeAbandonedTimeout="60"
        testWhileIdle="true" timeBetweenEvictionRunsMillis="180000"/>
    <Realm
        className="org.apache.catalina.realm.DataSourceRealm"
        dataSourceName="jdbc/RealmDB" localDataSource="true"
        digest="MD5"
        userTable="users" userNameCol="users_name" userCredCol="password"
        userRoleTable="tcrole" roleNameCol="role_name" />
</Context>

My Database credentials are fine.  When I do a select * from users where
user_name="JGooding" I get the proper things back

Here is my web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
  <display-name>MMO</display-name>
  <description>MMO Testing</description>

  <resource-ref>
     <res-type>javax.sql.DataSource</res-type>
     <res-ref-name>jdbc/RealmDB</res-ref-name>
     <res-auth>Container</res-auth>
  </resource-ref>

  <error-page>
     <error-code>403</error-code>
     <location>/error/403.jsp</location>
  </error-page>
  <error-page>
     <error-code>404</error-code>
     <location>/error/404.jsp</location>
  </error-page>

  <session-config>
     <session-timeout>480</session-timeout>
  </session-config>

  <welcome-file-list>
     <welcome-file>Main.jsp</welcome-file>
  </welcome-file-list>

  <!--Constraints to control access to an entire namespace of urls-->
        <security-constraint><!--/admin/* limits access to those in admin
role.-->
        <web-resource-collection>
            <web-resource-name>MMO</web-resource-name>
            <url-pattern>/admin/*</url-pattern>
            <http-method>DELETE</http-method>
            <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>
       </security-constraint>

       <security-constraint><!--/Private/* completely blocks access except
by the webserver itself.-->
        <web-resource-collection>
            <web-resource-name>MMO</web-resource-name>
            <url-pattern>/private/*</url-pattern>
            <http-method>DELETE</http-method>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name></role-name>
        </auth-constraint>
    </security-constraint>

    <!--Constraints to limit access to individual urls which are not limited
by any namespace in their url-->
    <security-constraint><!--/Main.jsp requires login, but then is available
to everybody who can login.-->
        <web-resource-collection>
            <web-resource-name>MMO</web-resource-name>
            <url-pattern>/Main.jsp</url-pattern>
            <http-method>DELETE</http-method>
            <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>
            <role-name>player</role-name>
        </auth-constraint>
    </security-constraint>

  <login-config>
     <auth-method>FORM</auth-method>
     <realm-name>MMO</realm-name>
     <form-login-config>
        <form-login-page>/private/Login.jsp</form-login-page>
        <form-error-page>/private/Login.jsp</form-error-page>
     </form-login-config>
  </login-config>
</web-app>

My Main.jsp is in the root directory of the webapps/[my proj] folder and the
Login.jsp is in /webapps/[my proj]/private.  So now for the issues.  When I
login with j_security_check, I get no errors, so as much as I hate making
assumptions, I'm going to assume that nothing is wrong with the realm.
However what's happening is that when I login, it's just reverting back to
the login page.  I checked the catalina.out and localhost.[current day] logs
and I'm not getting an errors.  Any ideas on what could cause this?  It's
been forever and a day since I set up my last realm.

Warmest regards,

- Josh

Reply via email to