-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token refresh doesn't seem to work properly #123
Comments
CC @mstruk |
Maybe the most obvious thing - is reauthentication enabled on your broker? See https://github.com/strimzi/strimzi-kafka-oauth#enabling-the-re-authentication The logs you've pasted show the client refreshing the token, but not the client performing re-authentication. Kafka Clients library has settings that control how much time before expiry should the client fetch a new token for authentication. The layer performing the client authentication to the authorization server is JAAS based (refreshing the token by client is called re-login) and is separate from the layer performing client - broker authentication or re-authentication (when client sends the access token to the broker for authentication). These two layers don't talk to each other very well - re-login runs on its determined schedule based on the token expiry time. As a result it can happen, if token expiry is short and the parameters controlling re-login are not adjusted that re-authentication grabs an old not-yet-refreshed token to re-authenticate. In which case, when the token expires, you may see the session terminate. I can't comment on the OAuthBearerLoginModule.java , I never needed to delve this deep into it, and re-authentication tests I've been performing in the past seemed to work fine. |
Our Access Key lifespan was set to only 5 min. |
Inital login will work as expected
Which shows the token as expiring at
Wed Sep 08 21:23:37 UTC 2021
The refresh will occur as shown here:
However the kafka client used will still stop working at the orignial expire time of
Wed Sep 08 21:23:37 UTC 2021
This is with a akhq client: https://github.com/tchiotludo/akhq
using the following config with server urls and client ids removed:
as far as i can tell this happens because this line should be
!=
instead of==
https://github.com/a0x8o/kafka/blob/master/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/OAuthBearerLoginModule.java#L364
or that something is very wrong with the default time ranges since this part of the log
seems to imply given the code in
OAuthBearerLoginModule
that the token that was just added is the one that gets removed.The text was updated successfully, but these errors were encountered: