-
Notifications
You must be signed in to change notification settings - Fork 26
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
Make sure refreshing OAuth token is idempotent #3650
Conversation
Deploying matrix-authentication-service-docs with
|
Latest commit: |
e64e5f5
|
Status: | ✅ Deploy successful! |
Preview URL: | https://7a059f05.matrix-authentication-service-docs.pages.dev |
Branch Preview URL: | https://quenting-refresh-idempotence.matrix-authentication-service-docs.pages.dev |
This will help us determine whether we had a double-refresh happening
If we continue deleting expired tokens, we might not record whether the token was used or not, and not know what to do in case of a double-refresh. Revoked tokens are safe to delete. This also reduces the frequency of the cleanup job to once an hour.
This lets us track 'revoked' tokens separately from 'consumed' tokens.
This allows using a refresh token multiple times, as long as the new pair of tokens were not used in the meantime.
89331a3
to
76137c4
Compare
&state.clock, | ||
&mut repo, | ||
&session, | ||
Duration::microseconds(5 * 60 * 1000 * 1000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there really no way to do Duration::seconds(5 * 60)
lol? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's the only one that can't panic, and clippy will complain that we don't document that potential panic I think? 😬
('idempotent' seems like a misleading word since the old tokens get revoked, rather than returned again, but not sure if there's a more accurate word that matches it better) |
Co-authored-by: reivilibre <oliverw@element.io>
Fixes #2795
This can be reviewed commit by commit
It is basically: