use of com.zimbra.cs.service.authenticator.SSOAuthenticator.SSOAuthenticatorServiceException in project zm-mailbox by Zimbra.
the class SpnegoFilter method doFilter.
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
HttpServletRequest hreq = (HttpServletRequest) req;
HttpServletResponse hresp = (HttpServletResponse) resp;
try {
try {
authenticate(hreq, hresp);
} catch (SSOAuthenticatorServiceException e) {
if (SSOAuthenticatorServiceException.SENT_CHALLENGE.equals(e.getCode())) {
return;
} else {
throw e;
}
}
chain.doFilter(req, resp);
} catch (ServiceException e) {
ZimbraServlet.addRemoteIpToLoggingContext(hreq);
ZimbraServlet.addUAToLoggingContext(hreq);
if (e instanceof AuthFailedServiceException) {
AuthFailedServiceException afe = (AuthFailedServiceException) e;
ZimbraLog.account.info("spnego auth failed: " + afe.getMessage() + afe.getReason(", %s"));
} else {
ZimbraLog.account.info("spnego auth failed: " + e.getMessage());
}
ZimbraLog.account.debug("spnego auth failed", e);
ZimbraLog.clearContext();
if (passThruOnAuthFailure(hreq)) {
chain.doFilter(req, resp);
} else {
hresp.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
}
}
}
Aggregations