use of com.sun.identity.rest.HttpServletRequestWrapperEx in project OpenAM by OpenRock.
the class SSOTokenAuthN method doFilter.
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (!hasCookie((HttpServletRequest) request)) {
redirect((HttpServletRequest) request, (HttpServletResponse) response);
} else {
try {
SSOTokenManager mgr = SSOTokenManager.getInstance();
SSOToken token = mgr.createSSOToken((HttpServletRequest) request);
HttpServletRequestWrapperEx reqWrapper = new HttpServletRequestWrapperEx((HttpServletRequest) request);
reqWrapper.setUserPrincipal(new SSOTokenPrincipal(token));
chain.doFilter(reqWrapper, response);
} catch (SSOException e) {
redirect((HttpServletRequest) request, (HttpServletResponse) response);
}
}
}
Aggregations