tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Realms - info/documentation?
Date Sat, 03 Nov 2001 01:34:25 GMT

On Fri, 2 Nov 2001, Adrian Hall wrote:

> Date: Fri, 2 Nov 2001 16:28:12 -0800
> From: Adrian Hall <>
> Reply-To: Tomcat Users List <>
> To:
> Subject: Realms - info/documentation?
> Hi,
> I am wanting to write a new security realm for a web application that
> I am currently developing.  I had hoped to use one of the standard
> realms to do this, but no dice.  Now, I would like information on the
> following:
> How standard are realms?  Will my new realm class be importable into
> BEA or some other Application Server, for example?  (I have only used
> Tomcat, but want to allow other environments - Im an open sort of guy)

Realms are totally specific to Tomcat.  In a J2EE 1.4 time frame (i.e. the
next major release) there is some work going on to standardize a service
provider interface for containers to connect to underlying security
infrastructures, but in the mean time each container is on their own.

(This effort is JSR 115.)

> I wish to put something like the following in the config file:
>     <Realm className="org.mps.realm.MiraRealm" Server=""
>           Base="domain" UserID="uid" />
> I noticed that JDBC and JNDI realms (nice examples, btw) all have
> attributes - do I just have to include a setXXX (where XXX is my
> attribute in the XML statement) to get these attributes into my
> object?

The code that processes server.xml uses Java reflection to match up
attribute names to corresponding property setters.  For example, an
attribute named "server" would be mapped to a corresponding "getServer()"
method call.

Note - you should really use lower case property names to make this work.

> Can I place my realm statement in my web applications web.xml
> document?  If so, can I place it inside the <web-app> directive, or do
> I need to place it outside (and before) the <web-app> directive?

No -- this goes in server.xml.  See the configuration docs for more info.

> Other than start(), stop() and authenticate(String, String), are there
> any other methods which I will generally need to implement?  I noticed
> getInfo() and getName() - are they required - if they are, is the
> format of the output fixed, or dynamic?

The only things that are required are those listed in the
org.apache.catalina.Realm interface.

Conventionally, most of the modules have a "debug" property, but that's up
to you.

> Thanks for the help in advance
> Regards,
> Adrian Hall


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message