This content has been marked as final.
Show 1 reply
-
1. Re: getRemoteUser() in Filter
brunoskrebs.bruno.krebseng.com.br Jul 14, 2010 8:33 AM (in response to brunoskrebs.bruno.krebseng.com.br)Ok, I think I managed to do what I want, so just for record I'm posting it for further reference...
@Startup @Scope(ScopeType.APPLICATION) @Name("br.com.dbccompany.fiergs.controller.OSSOFilter") @BypassInterceptors @Filter(within="org.jboss.seam.web.multipartFilter") public class OSSOFilter extends AbstractFilter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession session = ((HttpServletRequest) request).getSession(false); if (session != null) { Object attribute = session.getAttribute("org.jboss.seam.security.identity"); if (attribute instanceof Identity) { Identity identity = (Identity) attribute; System.out.println("+++++++++++++++++++++++++++++++++++++++++++++"); System.out.println(identity.getCredentials().getUsername()); } } chain.doFilter(request, response); } }
So as you can see I try to take a session from the user and then the user credentials (which is supposed to be the same from req.getRemoteUser()). Then I'm able to manipulate it as I want.