You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lars Ohlén <la...@ohlen.se> on 2005/05/10 18:00:45 UTC

Tomcat 5.5.9 - simple way of restricting access to webapp

Hi user group,

Is there any easy way to restrict the access to a specifc webapp by require login?

/L

Re: Tomcat 5.5.9 - simple way of restricting access to webapp

Posted by Lutz Zetzsche <Lu...@sea-rescue.de>.
Hi Lars,

Am Dienstag, 10. Mai 2005 18:00 schrieb Lars Ohlén:
> Is there any easy way to restrict the access to a specifc webapp by
> require login?

Yes. :-) It is a little bit time-consuming to tell it in detail. So I 
just show you how it is configured for the Manager application by 
default:


1. server.xml:

  <GlobalNamingResources>

    [...]

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>


2. manager.xml (=[webapp].xml):

 <!-- Link to the user database we will get roles from -->
  <ResourceLink name="users" global="UserDatabase"
                type="org.apache.catalina.UserDatabase"/>


3. web.xml:

<!-- Define reference to the user database for looking up roles -->
  <resource-env-ref>
    <description>
      Link to the UserDatabase instance from which we request lists of
      defined role names.  Typically, this will be connected to the 
global
      user database with a ResourceLink element in server.xml or the 
context
      configuration file for the Manager web application.
    </description>
    <resource-env-ref-name>users</resource-env-ref-name>
    <resource-env-ref-type>
      org.apache.catalina.UserDatabase
    </resource-env-ref-type>
  </resource-env-ref>


You may also have a look at the following pages of the Tomcat 
documentation for further details:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/realm-howto.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/globalresources.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/realm.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/resources.html


Best wishes

Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org