Source:
private void authenticateOnCluster(ClientConnection connection) { ClientMessage request = encodeAuthenticationRequest(); ClientInvocationFuture future = new ClientInvocation(client, request, null, connection).invokeUrgent(); ClientAuthenticationCodec.ResponseParameters response; try { response = ClientAuthenticationCodec.decodeResponse(future.get(authenticationTimeout, MILLISECONDS)); } catch (Exception e) { connection.close("Failed to authenticate connection", e); throw rethrow(e); } AuthenticationStatus authenticationStatus = AuthenticationStatus.getById(response.status); if (failoverConfigProvided && !response.failoverSupported) { logger.warning("Cluster does not support failover. This feature is available in Hazelcast Enterprise"); authenticationStatus = NOT_ALLOWED_IN_CLUSTER; } switch (authenticationStatus) { case AUTHENTICATED: handleSuccessfulAuth(connection, response); break; case CREDENTIALS_FAILED: AuthenticationException authException = new AuthenticationException("Invalid credentials!" + " Either ClientConfig.getClusterName() or" + " ClientConfig.getSecurityConfig() is inconsistent with the cluster config."); connection.close("Failed to authenticate connection", authException); throw authException; case NOT_ALLOWED_IN_CLUSTER: ClientNotAllowedInClusterException notAllowedException = new ClientNotAllowedInClusterException("Client is not allowed in the cluster"); connection.close("Failed to authenticate connection", notAllowedException); throw notAllowedException; default: AuthenticationException exception = new AuthenticationException("Authentication status code not supported. status: " + authenticationStatus); connection.close("Failed to authenticate connection", exception); throw exception; } }

Target:
private void authenticateOnCluster(ClientConnection connection) { ClientMessage request = encodeAuthenticationRequest(); ClientInvocationFuture future = new ClientInvocation(client, request, null, connection).invokeUrgent(); ClientAuthenticationCodec.ResponseParameters response; try { response = ClientAuthenticationCodec.decodeResponse(future.get(authenticationTimeout, MILLISECONDS)); } catch (Exception e) { connection.close("Failed to authenticate connection", e); throw rethrow(e); } AuthenticationStatus authenticationStatus = AuthenticationStatus.getById(response.status); if (failoverConfigProvided && !response.failoverSupported) { logger.warning("Cluster does not support failover. This feature is available in Hazelcast Enterprise"); authenticationStatus = NOT_ALLOWED_IN_CLUSTER; } switch (authenticationStatus) { case AUTHENTICATED: handleSuccessfulAuth(connection, response); break; case CREDENTIALS_FAILED: AuthenticationException authException = new AuthenticationException("Authentication failed. The configured " + "cluster name on the client (see ClientConfig.setClusterName()) does not match the one configured in " + "the cluster or the credentials set in the Client security config could not be authenticated"); connection.close("Failed to authenticate connection", authException); throw authException; case NOT_ALLOWED_IN_CLUSTER: ClientNotAllowedInClusterException notAllowedException = new ClientNotAllowedInClusterException("Client is not allowed in the cluster"); connection.close("Failed to authenticate connection", notAllowedException); throw notAllowedException; default: AuthenticationException exception = new AuthenticationException("Authentication status code not supported. status: " + authenticationStatus); connection.close("Failed to authenticate connection", exception); throw exception; } }