use of org.apache.kafka.common.errors.AuthenticationException in project kafka by apache.
the class SaslClientAuthenticator method handleKafkaResponse.
private void handleKafkaResponse(RequestHeader requestHeader, byte[] responseBytes) {
AbstractResponse response;
ApiKeys apiKey;
try {
response = NetworkClient.parseResponse(ByteBuffer.wrap(responseBytes), requestHeader);
apiKey = ApiKeys.forId(requestHeader.apiKey());
} catch (SchemaException | IllegalArgumentException e) {
LOG.debug("Invalid SASL mechanism response, server may be expecting only GSSAPI tokens");
throw new AuthenticationException("Invalid SASL mechanism response", e);
}
switch(apiKey) {
case SASL_HANDSHAKE:
handleSaslHandshakeResponse((SaslHandshakeResponse) response);
break;
default:
throw new IllegalStateException("Unexpected API key during handshake: " + apiKey);
}
}
Aggregations