public SubjectAuthenticationResult authenticate(SaslNegotiator saslNegotiator, byte[] response) { AuthenticationResult authenticationResult = saslNegotiator.handleResponse(response); if(authenticationResult.getStatus() == AuthenticationStatus.SUCCESS) { return createResultWithGroups(authenticationResult); } else { if (authenticationResult.getStatus() == AuthenticationStatus.ERROR) { String authenticationId = saslNegotiator.getAttemptedAuthenticationId(); _authenticationProvider.getEventLogger().message(AUTHENTICATION_FAILED(authenticationId, authenticationId != null)); } return new SubjectAuthenticationResult(authenticationResult); } }