use of org.apache.kafka.common.security.auth.SaslAuthenticationContext in project apache-kafka-on-k8s by banzaicloud.
the class SaslServerAuthenticator method principal.
@Override
public KafkaPrincipal principal() {
SaslAuthenticationContext context = new SaslAuthenticationContext(saslServer, securityProtocol, clientAddress());
KafkaPrincipal principal = principalBuilder.build(context);
if (ScramMechanism.isScram(saslMechanism) && Boolean.parseBoolean((String) saslServer.getNegotiatedProperty(ScramLoginModule.TOKEN_AUTH_CONFIG))) {
principal.tokenAuthenticated(true);
}
return principal;
}
use of org.apache.kafka.common.security.auth.SaslAuthenticationContext in project kafka by apache.
the class SaslServerAuthenticator method principal.
@Override
public KafkaPrincipal principal() {
Optional<SSLSession> sslSession = transportLayer instanceof SslTransportLayer ? Optional.of(((SslTransportLayer) transportLayer).sslSession()) : Optional.empty();
SaslAuthenticationContext context = new SaslAuthenticationContext(saslServer, securityProtocol, clientAddress(), listenerName.value(), sslSession);
KafkaPrincipal principal = principalBuilder.build(context);
if (ScramMechanism.isScram(saslMechanism) && Boolean.parseBoolean((String) saslServer.getNegotiatedProperty(ScramLoginModule.TOKEN_AUTH_CONFIG))) {
principal.tokenAuthenticated(true);
}
return principal;
}
Aggregations