Skip to content

Add default scopes fallback for client_credentials/password/token_exchange grants#25356

Merged
EngincanV merged 5 commits into
devfrom
feat-openiddict-default-scopes-fallback
May 4, 2026
Merged

Add default scopes fallback for client_credentials/password/token_exchange grants#25356
EngincanV merged 5 commits into
devfrom
feat-openiddict-default-scopes-fallback

Conversation

@maliming

@maliming maliming commented May 2, 2026

Copy link
Copy Markdown
Member

Adds three opt-in switches on AbpOpenIddictAspNetCoreOptions so the access token issued for client_credentials / password / urn:ietf:params:oauth:grant-type:token-exchange grants can fall back to the scopes registered on the client (oi_scp: permissions) when the client did not pass a scope parameter. All default to false.

  • UseDefaultScopesForClientCredentials
  • UseDefaultScopesForPassword
  • UseDefaultScopesForTokenExchange

Copilot AI review requested due to automatic review settings May 2, 2026 06:55
@maliming maliming changed the title Add default scopes fallback for // grants Add default scopes fallback for client_credentials/password/token_exchange grants May 2, 2026
@maliming maliming added this to the 10.5-preview milestone May 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an opt-in “default scopes” fallback for non-interactive token grants in the OpenIddict ASP.NET Core integration, allowing tokens to inherit the client application’s configured scope permissions when the scope parameter is omitted.

Changes:

  • Added AbpDefaultScopesHandler to inject default scopes/resources from client oi_scp: permissions when enabled and no scopes were requested.
  • Introduced three new opt-in switches on AbpOpenIddictAspNetCoreOptions to control the behavior per grant type.
  • Updated the module to register the new claims principal handler and ensure preconfigured AbpOpenIddictAspNetCoreOptions are applied to IOptions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Claims/AbpDefaultScopesHandler.cs New handler that applies default client scopes/resources when enabled and request scopes are empty.
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictOptions.cs Adds three boolean options to enable default-scope fallback for selected grants.
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs Registers the new handler and ensures preconfigured options flow into IOptions.
modules/openiddict/app/OpenIddict.Demo.Server/OpenIddict.Demo.Server.csproj Adds EF Core Design package reference for the demo server project.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@codecov

codecov Bot commented May 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.32%. Comparing base (69c6768) to head (9ad9d98).
⚠️ Report is 45 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #25356      +/-   ##
==========================================
- Coverage   49.33%   49.32%   -0.02%     
==========================================
  Files        3667     3667              
  Lines      123121   123121              
  Branches     9404     9404              
==========================================
- Hits        60741    60726      -15     
- Misses      60557    60571      +14     
- Partials     1823     1824       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maliming maliming requested a review from EngincanV May 4, 2026 05:53
@EngincanV EngincanV merged commit dab2081 into dev May 4, 2026
3 of 4 checks passed
@EngincanV EngincanV deleted the feat-openiddict-default-scopes-fallback branch May 4, 2026 14:13
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.

3 participants