tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Gierke <>
Subject Re: Possible to expose a Tomcat Realm instance through JNDI ?
Date Wed, 12 Jun 2013 06:12:51 GMT
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