You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Michael Jennings <so...@home.com> on 2001/06/06 17:55:47 UTC

per-context realms

Hi everyone,

Does anyone have an idea of how I could go about implementing
realms/authentication on a per-context basis?
Ideally, what I would like to do is have each context control
their users and roles. Where should I look to get a clue?

-Mike

______________________
Mike Jennings
Southgate  Software Ltd.
250-382-6851 (ph)
250-382-6800 (fax)
southgate.software@home.com


Re: per-context realms

Posted by Michael Jennings <so...@home.com>.
Thanks!
That is EXACTLY what I was looking for!

-Mike


----- Original Message ----- 
From: "Antony Bowesman" <ad...@teamware.com>
To: <to...@jakarta.apache.org>
Sent: Wednesday, June 06, 2001 10:39 PM
Subject: Re: per-context realms


> Michael Jennings wrote:
> > 
> > Hi everyone,
> > 
> > Does anyone have an idea of how I could go about implementing
> > realms/authentication on a per-context basis?
> > Ideally, what I would like to do is have each context control
> > their users and roles. Where should I look to get a clue?
> 
> Make a simple realm implementation that simply gets the real realm
> config information from the context passed with the request, e.g.
> 
> authenticate(Req)
> {
>    Context ctx = req.getContext();
> 
>    // Now you have all the context config available
> ..
> }
> 
> I have a JAAS realm which has context specific realm config using the
> 
>   <context-param>
>     <param-name>Name</param-name>
>     <param-value>Value</param-value>
>   </context-param>
> 
> attributes in web.xml to provide context specific control.
> 
> In the realm, just so
> 
>    String ctxNameValue = ctx.getInitParameter("Name");
> 
> or similar.  With JAAS this is easy, because JAAS allows for different
> JAAS configurations to be used, you just specify a different config name
> to the JAAS context.
> 
> Antony


Re: per-context realms

Posted by Antony Bowesman <ad...@teamware.com>.
Michael Jennings wrote:
> 
> Hi everyone,
> 
> Does anyone have an idea of how I could go about implementing
> realms/authentication on a per-context basis?
> Ideally, what I would like to do is have each context control
> their users and roles. Where should I look to get a clue?

Make a simple realm implementation that simply gets the real realm
config information from the context passed with the request, e.g.

authenticate(Req)
{
   Context ctx = req.getContext();

   // Now you have all the context config available
..
}

I have a JAAS realm which has context specific realm config using the

  <context-param>
    <param-name>Name</param-name>
    <param-value>Value</param-value>
  </context-param>

attributes in web.xml to provide context specific control.

In the realm, just so

   String ctxNameValue = ctx.getInitParameter("Name");

or similar.  With JAAS this is easy, because JAAS allows for different
JAAS configurations to be used, you just specify a different config name
to the JAAS context.

Antony

Re: per-context realms

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 6 Jun 2001, Michael Jennings wrote:

> Hi everyone,
> 
> Does anyone have an idea of how I could go about implementing
> realms/authentication on a per-context basis?
> Ideally, what I would like to do is have each context control
> their users and roles. Where should I look to get a clue?
> 

Tomcat 4 lets you do this "out of the box".  You can define your realm at
the Engine, Host, or Context (i.e. webapp) level -- whatever suits your
requirements.

> -Mike
> 


Craig