-
Notifications
You must be signed in to change notification settings - Fork 102
Description
Hello,
I have noticed that multiple calls to the IDP server(Keycloak) are made, I expect one call to the IDP server and the token to be shared across multiple connections, I see that the same is mentioned in the docs as well, But I am not able to achieve this.
On the client the access token is reused for multiple connections with the Kafka Broker. Before it expires the token is refreshed in the background so that a valid token is always available for all the connections. ``
Some logs:
[main] INFO org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - [Consumer clientId=consumer-a_consumer-group-1, groupId=a_consumer-group] Notifying assignor about the new Assignment(partitions=[a_Topic1-0])
[main] INFO org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - [Consumer clientId=consumer-a_consumer-group-1, groupId=a_consumer-group] Adding newly assigned partitions: a_Topic1-0
[main] INFO org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - [Consumer clientId=consumer-a_consumer-group-1, groupId=a_consumer-group] Setting offset for partition a_Topic1-0 to the committed offset FetchPosition{offset=2, offsetEpoch=Optional[0], currentLeader=LeaderAndEpoch{leader=Optional[localhost:9093 (id: 0 rack: null)], epoch=0}}
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] INFO org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-a_consumer-group-1, groupId=a_consumer-group] Node -1 disconnected.
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
[main] DEBUG io.strimzi.kafka.oauth.common.OAuthAuthenticator - loginWithClientSecret() - tokenEndpointUrl: https://localhost:8445/auth/realms/kafka/protocol/openid-connect/token, clientId: kafkabroker, clientSecret: Sv7ZMGDq, scope: null, audience: null, connectTimeout: 60, readTimeout: 60, retries: 0, retryPauseMillis: 0
Let me know if you need more details like configurations. or a minimum working code