-
Notifications
You must be signed in to change notification settings - Fork 58
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
Allow updating the Connection's token and/or JWT upon disconnect #356
Comments
Similar to #285 design wise providing callbacks and/or reading tokens/jwt from files might be a better option since opts is read-only. |
Has there been any more interest in this? After the discussion in #525, I think this is what I am looking for. When the user JWT that the NATS server associates with a given client connection expires, I'd want a way to be able to invoke a callback that can allow a client to get a new access token from my own authN server and trigger the auth callout flow again. |
@mtmk do you know if there has been any other interest for a feature like this in the nats.net library? Otherwise, are you aware of any workarounds? |
@garrett-sutton it's only folks in this issue afaik. I'm tiny bit snowed under at the minute. I think we basically need a callback in NatsOpts. If you or any other community members have some time please feel free to pop a PR in. Otherwise I will come back to it once I cleared my plate a little. |
@mtmk Thanks for the insight. I am interested in helping out here. One question though (apologies I'm a noob at open source contributions). After a PR is submitted, do you have a sense for how long for review? And how long until a new version of the library with this enhancement in it? |
@garrett-sutton that's great thank you! for our project it varies but it's usually pretty quick especially if there is interest. depending on how it goes all being well couple of days or so I'd guess in this case. |
Proposed change
Support using the disconnected callback to refresh the token or JWT used to authenticate to allow reconnecting without the need to create a new connection and subscribe to all the topic again.
Something like this (working snippet using the V1 client):
Use case
We have a long running application that subscribes to several NATS topics.
The authentication in our scenario is made using tokens, with expiration.
In order to allow the reconnect of the same connection upon disconnect, we need to provide a valid token, so it might need to be refreshed due to expiry date.
This proposal would void the need to create a new connection and re-subscribe to all topics,
Contribution
Yes, I'm glad to help (might lack some context on the internals though)
The text was updated successfully, but these errors were encountered: