tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject [tomcat4] Basic Authentication problem
Date Mon, 14 Jan 2002 22:58:12 GMT
Hello,

I am trying to add basic authentication for a servlet. This should be a
simple task and I'm quite sure I'm doing something stupid ... but I'm
failing to find the reason (note: I have it working on Tomcat 3.3).

I'm getting a 401 error.

I have the following directory structure :

<myroot>
  |_ conf
    |_ tomcat-users.xml
    |_ web.xml
    |_ server.xml
  |_ webapps
    |_ mywebapp.war

My server.xml is :

<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Service name="Tomcat-Standalone">
    <Connector
className="org.apache.catalina.connector.http.HttpConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
      <Host name="localhost" debug="0" appBase="full path to
<myroot>/webapps">
      </Host>
    </Engine>
  </Service>
</Server>

My tomcat-users.xml is :

<tomcat-users>
  <user name="testuser" password="testpwd" roles="test" />
</tomcat-users>

And my web.xml in mywebapp.war is :

[...]
    <servlet>
        <servlet-name>ServletRedirectorSecure</servlet-name>
 
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-c
lass>
    </servlet>

    <servlet-mapping>
        <servlet-name>ServletRedirector</servlet-name>
        <url-pattern>/ServletRedirector</url-pattern>
    </servlet-mapping>

    <security-constraint>
     	<web-resource-collection>
 
<web-resource-name>SecurityRestriction</web-resource-name>
         	<description>Protect the Cactus redirector
servlet.</description>
         	<url-pattern>/ServletRedirectorSecure</url-pattern>
         	<http-method>GET</http-method>
         	<http-method>POST</http-method>
     	</web-resource-collection>
     	<auth-constraint>
         	<description>Authorized Users Group</description>
         	<role-name>test</role-name>
     	</auth-constraint>
     	<user-data-constraint>
        	<transport-guarantee>NONE</transport-guarantee>
    	</user-data-constraint>
    </security-constraint>

    <login-config>
    	<auth-method>BASIC</auth-method>
    </login-config>

	<security-role>
		<description>Test role</description>
		<role-name>test</role-name>
	</security-role>

I am starting Tomcat as follows in Ant (where ${out.tomcat40.full.dir}"
point to the absolute path to <myroot> and ${tomcat.home.40} to where
Tomcat 4 is installed) :
 
        <java classname="org.apache.catalina.startup.Bootstrap"
fork="yes">
            <jvmarg value="-Dcatalina.home=${tomcat.home.40}"/>
            <arg value="-config"/>
            <arg value="${out.tomcat40.full.dir}/conf/server.xml"/>
            <arg value="start"/>
            <classpath>

              <!-- This is to allow the use of -Dbuild.sysclasspath=only
when
                   starting Ant - Meaning that all jars need to be on
the
                   initial classpath -->
              <pathelement path="${java.class.path}"/>

              <!-- These are ignore if -Dbuild.sysclasspath=only is used
-->
              <fileset dir="${tomcat.home.40}">
                  <include name="bin/bootstrap.jar"/>
                  <include name="server/catalina.jar"/>
              </fileset>
            </classpath>
        </java>

Any idea ?
Thanks
-Vincent



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message