strimzi / strimzi-kafka-oauth

OAuth2 support for Apache Kafka® to work with many OAuth2 authorization servers
Apache License 2.0
141 stars 89 forks source link

Reuse token that was recovered from strimzi oauth #245

Open jonatasvieira opened 1 month ago

jonatasvieira commented 1 month ago

I was looking if is it possible to use the token recovered from kafka. We have an architecture here that each microservice has its own cliendId and secret and we need this token to do other actions on other systems. To avoid new call to our oracle access manager, I was wondering if is possible to recover the token to use it.

jonatasvieira commented 1 month ago

@mstruk any suggestions?

mstruk commented 1 month ago

The event to call into Strimzi OAuth and provide the access token on the client is triggered by kafka-clients code, the token is handed over and there is no further way to intercept it. But you can create your own AuthenticateCallbackHandler implementation on the client that wraps the JaasClientOauthLoginCallbackHandler class, and configure yours as a login callback handler, and in that case you can intercept the handing over of the new access token, and then do with the token whatever you want.