private boolean isSuccessfulAuthenticatedMethodFound(HttpServerExchange exchange) { boolean successfulAuthenticatedMethodFound = false; List<AuthenticationMechanism> authenticationMechanisms = exchange.getSecurityContext().getAuthenticationMechanisms(); for (AuthenticationMechanism authenticationMechanism : authenticationMechanisms) { AuthenticationMechanism.AuthenticationMechanismOutcome authenticationMechanismOutcome = authenticationMechanism.authenticate(exchange, exchange.getSecurityContext()); if(authenticationMechanismOutcome.equals(AuthenticationMechanism.AuthenticationMechanismOutcome.AUTHENTICATED)) { successfulAuthenticatedMethodFound = true; } } return successfulAuthenticatedMethodFound; } }