Depending on which authentication mechanism that the broker is configured with you will need to configure the client with the following configuration properties:
security.protocol=SASL_PLAINTEXT
or SASL_SSL
, depending on if SSL is used.
sasl.mechanism=PLAIN
or any of the other mechanisms, see CONFIGURATION.md
sasl.username=...
and sasl.password=..
for PLAIN and SCRAM-.. mechanisms.
sasl.kerberos.service.name=..
for GSSAPI/Kerberos.
See CONFIGURATION.md for all available configuration properties, SASL mechanisms, etc.