tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tanglin, Oliver" <>
Subject RE: Possible to expose a Tomcat Realm instance through JNDI ?
Date Wed, 12 Jun 2013 09:04:07 GMT
Thanks for posting your results. 

But I am thinking now that this may lead to a portability issue. Push to a container other
than Tomcat and 'org.apache.catalina.User' will not be available on the classpath. 

Also, during development you are forced to include catalina as a dependency to compile. Or
are you somehow using reflection?


-----Original Message-----
From: on behalf of Tobias Gierke
Sent: Wed 6/12/2013 2:12 AM
Subject: Re: Possible to expose a Tomcat Realm instance through JNDI ?
Hi Oliver,
> I think I now understand your issue. I was faced with a similar problem and could not
figure out how to get the roles of an authenticated user through the servlet API.
> It seems to only allow the question 'request.isUserInRole(role)'. But does not seem to
provide a way to get a list of roles that the user is in.
> I used a kludge whereby I defined the valid roles in a context init parameter (bad duplication
of effort). Then used 'request.isUserInRole(role)'. I did not think to cast the 'request.getUserPrincipal()'
return value.
> Please post if your methodology works.
> Oliver
I ended up using WebserviceContext#getUserPrincipal() and downcasting it 
to org.apache.catalina.User ; should probably also work with the plain 
HttpServletRequest since WebserviceContext is just a wrapper.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message