On Sat, 19 Oct 2002, grenoml wrote:

> Date: Sat, 19 Oct 2002 13:33:16 -0700 (PDT)
> From: grenoml <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: Multiple Tomcat Security Realms
>
> I went through the REALM HOW-TO also.  It just tells
> you how to setup the various realm types but not how
> to configure multiple realms.
>

It's there, but sort of subtle.

The key point is that you can nest a <Realm> element in three different
places in server.xml, to get three different results:

* Nest inside <Engine> to affect all webapps on all virtual hosts.
  This is how things are set up in the default Tomcat server.xml file.

* Nest inside <Host> to affect all webapps on that virtual host,
  but no others.

* Nest inside <Context> to affect only that single webapp.

The search for the relevant realm is hierarchical, starting from the most
specific to the least specific.  So, one way to deal with your scenario
would be to simply leave the default setup alone (so that it supports the
admin and manager webapps as it does currently), then define a <Context>
element for each of your specific applications -- and nest a <Realm>
inside each of those <Context> elements to configure its own security
setup.

An alternate approach would be appropriate if you wanted to use the same
JDBCRealm for all apps *except* admin and manager:

* Move the existing <Realm> element from inside the <Engine> to inside
  new <Context> elements for the admin and manager webapps

* Make your JDBCRealm the default one (nested in the <Engine> element)
  for all other apps.

Craig


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

Reply via email to