tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: how to get realm name
Date Tue, 04 Aug 2009 04:21:30 GMT
> From: Robert Koberg [mailto:rob@koberg.com]
> Subject: how to get realm name
> 
> I have been looking through the code and API, but cannot find a way to
> get the realm name to perform the digest.

I can't find any direct mechanism either, if you don't want to use Tomcat internal classes.
 Here's a rather ugly method, but it might work.  The web.xml for the webapp is accessible
as a String via the JMX path:

Catalina:WebModule://[host]/[appName]:none:none:Attributes:deploymentDescriptor

Once retrieved, you could parse that for the <login-config> element.  (You could also
just read in the web.xml file, if running from an expanded war file.)

It does seem odd that there's not a standard API to retrieve the <login-config> values,
but I suppose that's because it's intended to be used only by container-managed authentication.

Note that if you leave out the <realm-name> element, it defaults to [host]:[port], which
is easily retrievable from the Request object via getServerName() and getServerPort().

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.


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


Mime
View raw message