This content has been marked as final.
Show 2 replies
-
1. Re: Propagate the user info to servlets
starksm64 May 26, 2004 9:31 PM (in response to a_wronski)You have to use the web container security to get this information into the request as tomcat does not know anything about the jboss SecurityAssociation. Your only other option is move this logic into a custom tomcat authentictor or valve.
-
2. Re: Propagate the user info to servlets
a_wronski May 27, 2004 1:18 PM (in response to a_wronski)Hi Scott!
Thanks for you help. I've wrote something like this:public class PrincipalValve extends ValveBase { public void invoke(Request req, Response res , ValveContext vctx) throws IOException, ServletException { HttpRequest httpReq = (HttpRequest)req; httpReq.setUserPrincipal( new SimplePrincipal("testPrincipal") ); vctx.invokeNext( httpReq, res); } }
This works greate but for full happiness I need one more method to work - httpServletRequest.isUserInRole(..). I thought about some wrapper but when I use javax.servlet.http.HttpServletRequestWrapper I get ClassCastException. Is it possible to do this in this way or sould I try something else?
I'll be very thankfull for any suggestions.
Artur Wronski