Source:
public boolean authenticate(final Request request, final HttpServletResponse response, final LoginConfig loginConfig) { if (this.context == null || this.context.getRealm() == null) { this.log.warn("missing context/realm"); this.sendError(response, HttpServletResponse.SC_SERVICE_UNAVAILABLE); return false; } this.log.debug("{} {}, contentlength: {}", request.getMethod(), request.getRequestURI(), Integer.valueOf(request.getContentLength())); final boolean negotiateCheck = request.getParameter("j_negotiate_check") != null; this.log.debug("negotiateCheck: {}", Boolean.valueOf(negotiateCheck)); final boolean securityCheck = request.getParameter("j_security_check") != null; this.log.debug("securityCheck: {}", Boolean.valueOf(securityCheck)); final Principal principal = request.getUserPrincipal(); final AuthorizationHeader authorizationHeader = new AuthorizationHeader(request); final boolean ntlmPost = authorizationHeader.isNtlmType1PostAuthorizationHeader(); this.log.debug("authorization: {}, ntlm post: {}", authorizationHeader, Boolean.valueOf(ntlmPost)); if (principal != null && !ntlmPost) { this.log.debug("previously authenticated user: {}", principal.getName()); return true; } else if (negotiateCheck) { if (!authorizationHeader.isNull()) { boolean negociateResult = this.negotiate(request, response, authorizationHeader); if (!negociateResult) { this.redirectTo(request, response, loginConfig.getErrorPage()); } return negociateResult; } this.log.debug("authorization required"); this.sendUnauthorized(response); return false; } else if (securityCheck) { final boolean postResult = this.post(request, response); if (!postResult) { this.redirectTo(request, response, loginConfig.getErrorPage()); } return postResult; } else { this.redirectTo(request, response, loginConfig.getLoginPage()); return false; } }

Target:
public boolean authenticate(final Request request, final HttpServletResponse response, final LoginConfig loginConfig) { if (this.context == null || this.context.getRealm() == null) { this.log.warn("missing context/realm"); this.sendError(response, HttpServletResponse.SC_SERVICE_UNAVAILABLE); return false; } this.log.debug("{} {}, contentlength: {}", request.getMethod(), request.getRequestURI(), Integer.valueOf(request.getContentLength())); final boolean negotiateCheck = request.getParameter("j_negotiate_check") != null; this.log.debug("negotiateCheck: {}", Boolean.valueOf(negotiateCheck)); final boolean securityCheck = request.getParameter("j_security_check") != null; this.log.debug("securityCheck: {}", Boolean.valueOf(securityCheck)); final Principal principal = request.getUserPrincipal(); final AuthorizationHeader authorizationHeader = new AuthorizationHeader(request); final boolean ntlmPost = authorizationHeader.isNtlmType1PostAuthorizationHeader(); this.log.debug("authorization: {}, ntlm post: {}", authorizationHeader, Boolean.valueOf(ntlmPost)); if (principal != null && !ntlmPost) { this.log.debug("previously authenticated user: {}", principal.getName()); return true; } else if (negotiateCheck) { if (!authorizationHeader.isNull()) { boolean negotiateResult = this.negotiate(request, response, authorizationHeader); if (!negotiateResult) { this.redirectTo(request, response, loginConfig.getErrorPage()); } return negotiateResult; } this.log.debug("authorization required"); this.sendUnauthorized(response); return false; } else if (securityCheck) { final boolean postResult = this.post(request, response); if (!postResult) { this.redirectTo(request, response, loginConfig.getErrorPage()); } return postResult; } else { this.redirectTo(request, response, loginConfig.getLoginPage()); return false; } }