feat: optional access token strategy override for DCR#4105
Conversation
Adds an optional configuration path `oidc.dynamic_client_registration.strategies.access_token` (`jwt` or `opaque`) that, when set, overrides the global `strategies.access_token` for clients created through OpenID Connect Dynamic Client Registration (RFC 7591). When unset, behaviour is unchanged: DCR-created clients inherit the global access token strategy at token-issuance time. Clients still cannot set `access_token_strategy` in the registration payload; the override is server-side only. The Admin API is unaffected. Closes ory#4060 Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds support for an optional ChangesDynamic Client Registration Access Token Strategy Override
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Note on failing CI checksThe two failing checks (
|
| Check | Open PRs (sample of 10) |
|---|---|
format |
6 fail / 4 pass |
scanners |
10 fail / 0 pass |
Happy to address either in a follow-up PR if a maintainer would like. I just wanted to keep this one focused on the feature in #4060. The PR-relevant checks (go test, all e2e suites memory/mysql/postgres/cockroach × opaque/jwt, CodeQL, grype on the PR image, CLA, PR title) are all green.
Summary
Adds an optional configuration path
oidc.dynamic_client_registration.strategies.access_token(jwtoropaque) that, when set, overrides the globalstrategies.access_tokenfor clients created through OpenID Connect Dynamic Client Registration (RFC 7591). When unset, behaviour is unchanged.Closes #4060
Behaviour
strategies.access_tokenstrategies.access_tokenopaqueopaque(global default)jwtjwt(global default)opaquejwtopaque(DCR override)jwtopaquejwt(DCR override)Clients cannot set
access_token_strategythemselves in the DCR payload — the existing 400 rejection is preserved. The Admin API is unaffected.Changes
spec/config.jsonand.schema/config.schema.json— schema for the new optional key.driver/config/provider.go—KeyDCRAccessTokenStrategyconstant andOIDCDynamicClientRegistrationAccessTokenStrategy(ctx)getter (returns empty when unset; defensively logs and falls back to empty for invalid values).client/validator.go—ValidateDynamicRegistrationapplies the configured override after the existing client-supplied rejection check; mirrors the existingDefaultClientScopeserver-side default pattern.client/validator_test.go— 5-case behaviour matrix (the 4 rows above plus the "client-supplied strategy still rejected even when override is active" guard).Backwards compatibility
client.access_token_strategycolumn.Test plan
go build ./...go vet ./client/... ./driver/config/...go test ./client/... ./driver/config/...go test -run TestValidateDynamicRegistrationAccessTokenStrategy -v ./client/...— all 5 cases passSummary by CodeRabbit
Release Notes