Kafka Client Application
This section provides sample code snippets to configure Service Registry Kafka serializer/deserializer (SerDes) configuration properties to access the secure Service Registry server.
Apicurio Registry supports both OAuth and BASIC auth at the same time. a custom authentication handler has been implemented to use OAuth Client Credentials flow to support BASIC auth. In other words, the client can provide BASIC auth credentials, and the server-side custom handler will extract the username/password and then use OAuth Client Credentials flow against the Keycloak server to obtain an access token. Once that is done, everything else works the same as if the client had provided an OAuth bearer token to begin with.
Visit official document for detailed information on how to configure Kafka SerDes in your producer and consumer Java client applications.
Example Application
We're going to use this example application for demostration. Visit Apicurio Registry Example Applications repository for more Java example applications.
Kafka serializer/deserializer (SerDes) configuration properties
Based on the authentication mechanism you're using for Service Registry, you need to update the example application code when creating Kaka Producer and Consumer object as the snippets below.
Basic Authentication configuration
OAuth configuration
Running Example Application
If the Kafka serializer/deserializer (SerDes) configuration properties are correct, you should be able to see application output similar to this when you run the application. This means the client application can connect and authenticate to Service Registry successfully.
Last updated