Sample Code Running Guide for the Kafka Token Authentication Mechanism
Procedure
- Configure Kafka Token Authentication on the Kafka server.
- Log in to FusionInsight Manager and choose Cluster > Services > Kafka. Click Configurations.
- Enable the token authentication mechanism.
Find the delegation.token.master.key parameter, which specifies the master key used to generate and verify tokens. Check whether the parameter has been configured. If it has been configured, and the value is not null, the token authentication mechanism has been enabled and does not need to be reconfigured. If the token authentication mechanism is configured again, the original token cannot be used.
The value of delegation.token.master.key can be customized, for example, Tokentest.
- Specify the SASL authentication mechanism used for the service.
Find the sasl.enabled.mechanisms parameter and set it to GSSAPI,SCRAM-SHA-256,SCRAM-SHA-512. Use commas (,) to separate the three items.
- Log in to a component using Scram.
Find the custom parameter kafka.config.expandor and set its name to listener.name.sasl_plaintext.scram-sha-512.sasl.jaas.config. Set the value to org.apache.kafka.common.security.scram.ScramLoginModule required;.
- Log in to FusionInsight Manager and restart all Broker instances of the Kafka service.
- Configure Kafka Token Authentication on the Kafka client.
Generate a token for the user. For details, see Kafka Token Authentication Mechanism Tool Usage.
- Configure the secondary development sample project.
Configure the required sample codes in Producer() and Consumer() of the secondary development sample project. For details about the required sample codes, see Kafka Token Authentication.
- Run the sample code.
- For how to debug applications on Windows, see Commissioning Applications on Windows.
- For how to debug applications on Linux, see Commissioning Applications on Linux.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot