fix(oauth): remove the implicit and password grants entirely#165
Merged
Conversation
The admin UI listed 'implicit' and 'password' as selectable grant types (marked deprecated) and the backend silently persisted them as gt:implicit / gt:password OpenIddict permissions on the client. They never actually worked — the server enables neither AllowImplicitFlow nor AllowPasswordFlow, so any real request is rejected at the token/authorize endpoint and discovery never advertises them — but a client could be configured with them, and the security-model doc's 'deliberately rejected' claim was only true by omission at the endpoint, not at config time. OAuth 2.1 removes both grants. Remove them for good: - Frontend: drop the two options from the client grant-type picker (the whole 'Deprecated' group goes with them). - Backend: remove the gt:implicit / gt:password constants and both mapping directions. A client that somehow still carries the permission maps to null on read (dropped from the DTO, stripped on next save). - Add OAuthAdminMapping.ValidateGrantTypes: any grant that doesn't map to a permission — implicit, password, or a typo — is now rejected with OAuth.UnsupportedGrantType on both create and update, instead of being silently dropped while building permissions. The rejection is now explicit and at config time. No seed or provisioning manifest used either grant (demo-seed's 'implicit' is a consent type, not a grant). Tests: unit ValidateGrantTypes accept/reject + the two removed grants map to null; integration OAuthGrantTypeAllowlistTests drives the real OAuthAdminService and asserts create + update reject implicit/password with a positive control. Unit 1402/1402, integration 537/538 (the one failure is the known last-dependent UserView catch-up flake — DcrRegistrationEndpointTests, green in isolation and logically unrelated to grant validation). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to a question about OAuth 2.0 vs 2.1 conformance. The admin UI listed
implicitandpasswordas selectable grant types (marked deprecated), and the backend silently persisted them asgt:implicit/gt:passwordOpenIddict permissions on the client.They never actually functioned — the server enables neither
AllowImplicitFlownorAllowPasswordFlow, so a real request is rejected at the token/authorize endpoint and discovery never advertises them. But two real problems remained:password, save with no error, and the client silently couldn't use it.OAuth 2.1 removes both grants. This removes them for good, at every layer.
What changed
ClientDetails.vue) — drop the two options from the grant-type picker; the whole "Deprecated" group goes with them.gt:implicit/gt:passwordconstants and both mapping directions. A legacy client that somehow still carries the permission maps to null on read (dropped from the DTO, stripped on next save).OAuthAdminMapping.ValidateGrantTypes— any grant that doesn't map to a supported permission (implicit, password, or a typo) is now rejected withOAuth.UnsupportedGrantTypeon both create and update, instead of being silently dropped while building permissions. Rejection is now explicit and at config time, which makes the doc's "deliberately rejected" claim true at the config layer.No seed or provisioning manifest used either grant (
demo-seed'simplicitis a consent type, not a grant).Testing
ValidateGrantTypesaccept/reject cases; the two removed grants now map to null.OAuthGrantTypeAllowlistTests): drives the realOAuthAdminServiceand asserts create + update rejectimplicit/passwordwithOAuth.UnsupportedGrantType, plus a positive control that the supported set still succeeds.DcrRegistrationEndpointTests), green in isolation and logically unrelated to grant validation (it asserts the discovery document, not client creation).🤖 Generated with Claude Code