-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support multiple refresh tokens per user. #1829
Conversation
b665f47
to
071d347
Compare
Signed-off-by: Ryota Arai <[email protected]>
071d347
to
53f57e0
Compare
I appreciate your work @ryotarai and I would welcome "multiple refresh token per user" feature, but I have some problems with how this change is designed:
I would also expect OfflineSessions.Refresh[clientID] to store information about all issued refresh tokens. (I know this is much more challenging as would require schema changes and storage plugins update)
|
@tkleczek First of all, thank you for reviewing!
I see. How about making
Yes, it is more challenging. Is it acceptable to let
It grows more than multi refresh is off, but I do not expect it to grow too much because refreshing token only updates an existing refresh record. However, I agree it would be good to have limit and overwrite old refreshes on LRU basis.
I understand. I'll implement refresh token expiry. |
I'd say it would be more consistent, but I still would like schema change much more.
I think this would be sth for maintainers to decide.
Each successful user authentication with "offline_access" scope requested would now create a new refresh token object. They are small, but so far all db objects were either bounded in number (either via short expiry time or limited to user x connector x client).
This could go in a separate PR as it's in fact independent of multiple refresh token support. There were some issues opened around this functionality, e.g. #1685. |
@ryotarai We are looking for this functionality in dex. Will be more than happy to help you if needed. |
Hi, @tanmaykm @vinod-trilio |
fixes #981
This PR introduces
enableMultiRefreshTokens
option into config to enable multi refresh tokens per user.In our environment, each user uses multiple id tokens in laptops so this feature is very helpful.
Details
enableMultiRefreshTokens
option defaults to false and in that case this PR does not change any behavior.enableMultiRefreshTokens
is true, Dex skips to delete a refresh token in issuing an id token.ListRefresh
andRevokeRefresh
gRPC API useStorage.ListRefreshTokens
inenableMultiRefreshTokens
mode. This can be heavy but num of refresh tokens not is expected very high (same as num of id tokens).storage.OfflineSessions.Refresh
contains the latest-issued refresh token.