tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yoav Shapira <yo...@apache.org>
Subject Re: Accessing a custom user principal from a JAAS Realm
Date Wed, 19 Oct 2005 22:22:19 GMT
Brad,
No need to CC me on the reply, I get the dev@tomcat copy already ;)

> Thanks for the reply. What version of Tomcat are you referring to? I am using
> Tomcat 5.0.28. With regards to your code below, there is no 
> getUserPrincipal() method on the org.apache.catalina.realm.GenericPrincipal 
> class. 

I'm talking about 5.5.12 and the 5.5.x branch in general, which has this
method.

> Furthermore, how's this for bizarre -- if I do an "instanceof" with the class
> returned from request.getUserPrincipal(), and print it out, I get the 
> following:
> 
> Principal class is: org.apache.catalina.realm.GenericPrincipal
> 
> However, if I try to cast it to that class type in the very next line of
> code, 
> the code throws a ClassCastException. Very weird.

It's bizarre to the point of making me think what you really have on your hand
is a configuration issue, with likely multiple versions of the Catalina classes
on the runtime classpath, rather than a coding issue.

> The library I am using is 
> the catalina.jar sent with the code (which I happen to be packaging in my 
> WEB-INF/lib directory of my webapp. 

I hope you don't mean to say you have a copy of catalina.jar in your
WEB-INF/lib.  If so, remove it ;)  There should only be one copy of that file
in Tomcat's server lib directory.

Yoav

Yoav Shapira
System Design and Management Fellow
MIT Sloan School of Management
Cambridge, MA, USA
yoavs@computer.org / www.yoavshapira.com

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


Mime
View raw message