Source:
private boolean authenticate() throws HttpAuthenticationException { List<HttpServerAuthenticationMechanism> authenticationMechanisms = mechanismSupplier.get(); if (required && authenticationMechanisms.size() == 0) { throw log.httpAuthenticationNoMechanisms(); } responders = new ArrayList<>(authenticationMechanisms.size()); boolean evaluationFailed = false; try { for (HttpServerAuthenticationMechanism nextMechanism : authenticationMechanisms) { currentMechanism = nextMechanism; try { nextMechanism.evaluateRequest(this); } catch (HttpAuthenticationException e) { evaluationFailed = true; log.trace("Request evaluation for mechanism '%s' failed.", nextMechanism.getMechanismName(), e); } if (isAuthenticated()) { if (successResponder != null) { statusCodeAllowed = true; successResponder.sendResponse(this); if (statusCode > 0) { httpExchangeSpi.setStatusCode(statusCode); return false; } } return true; } } currentMechanism = null; if (required || (authenticationAttempted && ignoreOptionalFailures == false)) { statusCodeAllowed = true; if (responders.size() > 0) { boolean atLeastOneChallenge = false; boolean statusSet = false; for (HttpServerMechanismsResponder responder : responders) { try { responder.sendResponse(this); atLeastOneChallenge = true; if (statusSet == false && statusCode > 0 && statusCode != OK) { httpExchangeSpi.setStatusCode(statusCode); statusSet = true; } } catch (HttpAuthenticationException e) { log.trace("Authentication mechanism unable to send challenge.", e); } } if (atLeastOneChallenge == false) { throw log.httpAuthenticationNoSuccessfulResponder(); } if (statusSet == false) { httpExchangeSpi.setStatusCode(OK); } } else { if (evaluationFailed) { throw log.httpAuthenticationFailedEvaluatingRequest(); } httpExchangeSpi.setStatusCode(FORBIDDEN); } return false; } return true; } finally { authenticationMechanisms.forEach(m -> m.dispose()); } }

Target:
private boolean authenticate() throws HttpAuthenticationException { List<HttpServerAuthenticationMechanism> authenticationMechanisms = mechanismSupplier.get(); if (required && authenticationMechanisms.size() == 0) { throw log.httpAuthenticationNoMechanisms(); } responders = new ArrayList<>(authenticationMechanisms.size()); boolean evaluationFailed = false; try { for (HttpServerAuthenticationMechanism nextMechanism : authenticationMechanisms) { currentMechanism = nextMechanism; try { nextMechanism.evaluateRequest(this); } catch (HttpAuthenticationException e) { evaluationFailed = true; log.trace("Request evaluation for mechanism '%s' failed.", nextMechanism.getMechanismName(), e); } if (isAuthenticated()) { if (successResponder != null) { statusCodeAllowed = true; successResponder.sendResponse(this); if (statusCode > 0) { httpExchangeSpi.setStatusCode(statusCode); return false; } } return true; } } currentMechanism = null; if (required || (authenticationAttempted && ignoreOptionalFailures == false)) { statusCodeAllowed = true; if (responders.size() > 0) { boolean atLeastOneChallenge = false; boolean statusSet = false; for (HttpServerMechanismsResponder responder : responders) { try { responder.sendResponse(this); atLeastOneChallenge = true; if (statusSet == false && statusCode > 0 && statusCode != OK) { httpExchangeSpi.setStatusCode(statusCode); statusSet = true; } } catch (HttpAuthenticationException e) { log.trace("HTTP Authentication mechanism unable to send challenge.", e); } } if (atLeastOneChallenge == false) { throw log.httpAuthenticationNoSuccessfulResponder(); } if (statusSet == false) { httpExchangeSpi.setStatusCode(OK); } } else { if (evaluationFailed) { throw log.httpAuthenticationFailedEvaluatingRequest(); } httpExchangeSpi.setStatusCode(FORBIDDEN); } return false; } return true; } finally { authenticationMechanisms.forEach(m -> m.dispose()); } }