I'm implementing a module of authentication to kafka with the java api and i want to log clientAddress as an information.
I found AuthenticationContext that can be used with KafkaPrincipalBuilder like this:
public class CustomPrincipalBuilder implements KafkaPrincipalBuilder {
@Override
public KafkaPrincipal build(AuthenticationContext authenticationContext) {
return new KafkaPrincipal("user", authenticationContext.clientAddress().getHostAddress());
}
}
but i don't know what to pass as AuthenticationContext when invoking .build() method from the main class .
Thanks in advance,