Search in sources :

Example 1 with HttpServletRequestWrapperEx

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);
        }
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) SSOTokenManager(com.iplanet.sso.SSOTokenManager) HttpServletRequestWrapperEx(com.sun.identity.rest.HttpServletRequestWrapperEx) SSOToken(com.iplanet.sso.SSOToken) SSOTokenPrincipal(com.sun.identity.rest.SSOTokenPrincipal) HttpServletResponse(javax.servlet.http.HttpServletResponse) SSOException(com.iplanet.sso.SSOException)

Aggregations

SSOException (com.iplanet.sso.SSOException)1 SSOToken (com.iplanet.sso.SSOToken)1 SSOTokenManager (com.iplanet.sso.SSOTokenManager)1 HttpServletRequestWrapperEx (com.sun.identity.rest.HttpServletRequestWrapperEx)1 SSOTokenPrincipal (com.sun.identity.rest.SSOTokenPrincipal)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1