keeps redirecting to logon page....

Rubens Carlos de Souza Gomes <rgomes-VLOl4Yabd7I4j/[email protected]> Thu, 7 Aug 2003 16:36:38 -0300
Newsgroups gmane.comp.java.securityfilter.user
Message-ID <C7A1A91FB3DCD311B1BD00508B62B75104FBDDD3@DIGINET_SP>
I am using JDBCRealm on Tomcat 4 along with Struts and security filter.
When after passing thru the logon page, I try to access a link in the
/secure area the server redirects to the logon page.  I had this problem
when using container management security, and then I switched to using the
security filter.  But the same problem remains.  Can someone check my
configurations below for any potential problems?  Do I need to implement any
code to make security management to work?

File       : web.xml
....
<web-app>
...
  <!-- Filtering -->
   <filter>
      <filter-name>Security Filter</filter-name>
      <filter-class>org.securityfilter.filter.SecurityFilter</filter-class>
      <init-param>
         <param-name>security-config</param-name>
         <param-value>/WEB-INF/securityfilter-config.xml</param-value>
         <description>Security Configuration File</description>
      </init-param>
      <init-param>
         <param-name>validate</param-name>
         <param-value>true</param-value>
         <description>Validate config file if set to true</description>
      </init-param>
   </filter>

   <!-- map all requests to the SecurityFilter, control what it does with
configuration settings -->
   <filter-mapping>
      <filter-name>Security Filter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>
...
....
</web-app>


File       : securityfilter-config.xml
....
<securityfilter-config>

  <security-constraint>
    <display-name>Security 1</display-name>
    <web-resource-collection>
      <web-resource-name>encripted_area</web-resource-name>
      <url-pattern>/logon.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>*</role-name>
    </auth-constraint>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>

  <security-constraint>
    <display-name>Security 2</display-name>
    <web-resource-collection>
      <web-resource-name>secure_area</web-resource-name>
      <url-pattern>/secure/*</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>ADMINISTRATOR</role-name>
      <role-name>OPERATOR</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>/logon.jsp</form-login-page>
      <form-error-page>/logon_error.jsp</form-error-page>
      <form-default-page>/secure/index.jsp</form-default-page>
    </form-login-config>
  </login-config>

  <security-role>
    <description>Administrator of the system</description>
    <role-name>ADMINISTRATOR</role-name>
  </security-role>
  <security-role>
    <description>All the operators</description>
    <role-name>OPERATOR</role-name>
  </security-role>

  <realm className="org.securityfilter.realm.catalina.CatalinaRealmAdapter"
/>
  <realm className="org.apache.catalina.realm.JDBCRealm">
    <realm-param name="driverName" value="oracle.jdbc.driver.OracleDrive"/>
    <realm-param name="debug" value="99"/>
    <realm-param name="connectionURL"
value="jdbc:oracle:thin:@oracle.noc.spo.dcn:1521:NMSTEST"/>
    <realm-param name="connectionName" value="nms"/>
    <realm-param name="connectionPassword" value="nms"/>
    <realm-param name="userTable" value="APPLICATION_USER"/>
    <realm-param name="userNameCol" value="USER_ID"/>
    <realm-param name="userCredCol" value="PASSWORD"/>
    <realm-param name="userRoleTable" value="APPLICATION_USER_ROLE"/>
    <realm-param name="roleNameCol" value="ID"/>
  </realm>

</securityfilter-config>

  File       : webnms.xml
...
<Context path="/webnms"
         docBase="webnms.war"
         reloadable="true"
         cookies="true"
         debug="99"
         useNaming="true"
         workDir="/var/opt/webnms/work">

...
  <!--   Database Realm    -->

  <Realm className="org.apache.catalina.realm.JDBCRealm" 
         debug="99"
         driverName="oracle.jdbc.driver.OracleDriver"
         connectionURL="jdbc:oracle:thin:@oracle.noc.spo.dcn:1521:NMSTEST"
         connectionName="nms" 
         connectionPassword="nms"
         userTable="APPLICATION_USER" 
         userNameCol="USER_ID" 
         userCredCol="PASSWORD"
         userRoleTable="APPLICATION_USER_ROLE" 
         roleNameCol="ID"/>

...
</Context>