Skip to content
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

Update the query used for authorizations pruning to exclude all authorizations that still have tokens attached #2251

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

kevinchalet
Copy link
Member

Currently, permanent authorizations that are not valid and still have tokens attached are not excluded by the query used in OpenIddict*AuthorizationStore.PruneAsync(): it's not a problem at all for MongoDB (which isn't relational), but for the EF Core-based store, it's now problematic since recent versions use batched deletes by default: if a token is still attached to an authorization, an exception is thrown when the DB detects an authorization still has children entities attached.

By changing the logic used in all the stores to always exclude authorizations (no matter the type) that still have tokens attached, this PR should greatly reduce that risk.

Related discussion: https://matrix.to/#/!DYBDMbtjENXaKIMiCN:gitter.im/$yOUcTNT72_AgmjK9vHKlg1kCpR776CsjDMLpWIIQYWA?via=gitter.im&via=matrix.org

@kevinchalet kevinchalet added this to the 6.1.0 milestone Feb 12, 2025
@kevinchalet kevinchalet self-assigned this Feb 12, 2025
@kevinchalet kevinchalet merged commit 6cb8af0 into openiddict:dev Feb 12, 2025
6 checks passed
@kevinchalet kevinchalet deleted the authorization_pruning branch February 12, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant