7 Replies Latest reply on Oct 28, 2003 12:13 AM by Binoy Shah

    JBoss3.2.2+Tomcat Basic Authentication

    bhavin_r Newbie

      Hi all,

      I wan to setup a simple Basic Authentication Application. My warfile name is private.war it contains a.html. I want to give authentication on accessing a.html

      When I try to hit a.html it gives me the HTTP basic authentication dialog box. but when i try giving user id and password..it does not authenticate me. and does not show the page. I am not able to figure out what the problem is.

      my settings are:
      web.xml:

      <?xml version="1.0"?>
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>

      <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>

      <security-constraint>
      <web-resource-collection>
      <web-resource-name>a</web-resource-name>

      <url-pattern>/a.html</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
      </web-resource-collection>
      <auth-constraint>

      <role-name>admin</role-name>
      </auth-constraint>

      </security-constraint>

      <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>ZREALM</realm-name>
      </login-config>

      <security-role>
      <role-name>admin</role-name>
      </security-role>

      </web-app>

      jboss-web.xml:

      <jboss-web>

      <security-domain>java:/jaas/other</security-domain>

      </jboss-web>

      login-config.xml:
      has this as one of the entry by default:

      <application-policy name = "other">

      <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>

      the follwoing two files are in web-inf > classes folder

      users.properties
      admin=admin

      roles.properties:
      admin=admin

      so when i try using admin/admin it should allow me to see a.html...isn't it ?

      what could be the problem....?

      can any one send me a simple basic authentication example in war file..so that i can test it directly on my jboss server...?

      thanks in advance

      bhavin
      bhavin_raichura@hotmail.com