CloudFederationApi: access-token lifecycle fixes - #61889
Conversation
83513fa to
60f962d
Compare
|
I was able to verify this in my testrig: Then after unshare: |
0d5d5f2 to
455f467
Compare
455f467 to
aa41eb1
Compare
The cleanup job only deleted ocm_token_map rows, orphaning the temporary access tokens in oc_authtoken so they accumulated indefinitely. Revoke each expired access token before dropping its mapping. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
…s removed Extract the revoke-then-delete logic into OcmTokenService and add a ShareDeletedEvent listener that revokes the access tokens exchanged from a removed share's secret, drops their ocm_token_map rows, and invalidates the refresh token — instead of leaving them until the expiry job, which can no longer find them once the share is gone. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
…oken A refresh token may back several concurrent access tokens. E.g. in a multi protocol share for a webapp the webdav mount and the webapp launcher exchange the same secret, so the exchange must not assume a single mapping. Drop the revoke-previous step and the findByRefreshToken (findEntity) lookup, which threw MultipleObjectsReturnedException once more than one access token existed. Expiry and unshare cleanup revoke the tokens instead. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Micke Nordin <kano@sunet.se>
Also update stale comment that mentioned a function that no longer exists. Signed-off-by: Micke Nordin <kano@sunet.se>
aa41eb1 to
58cf6c7
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Fixes three lifecycle bugs in the OCM access-token exchange
A refresh token (the OCM sharedSecret) can back several concurrent access tokens.
CleanupExpiredOcmTokensJobonly deletedocm_token_mapnot the access tokens inoc_authtokenA new
ShareDeletedEventlistener revokes all access tokens exchanged from the removed share's secretChecklist
AI (if applicable)