Skip to content

Use requested scope when refresh response omits it - #20110

Open
amalsaidov wants to merge 1 commit into
spring-projects:mainfrom
amalsaidov:gh-20063
Open

amalsaidov wants to merge 1 commit into
spring-projects:mainfrom
amalsaidov:gh-20063

Conversation

@amalsaidov

Copy link
Copy Markdown

When a refresh token response omits the scope parameter, RFC 6749 section 5.1 defines the granted scope as identical to the scope requested by the client. RestClientRefreshTokenTokenResponseClient and WebClientReactiveRefreshTokenTokenResponseClient both fell back to the previously granted scope instead, so a request that narrowed the scope (for example from read write down to read) kept the wider scope in the resulting access token.

This changes only the scope metadata recorded by the client. It does not change what the authorization server grants, and the resulting scope is narrower rather than wider.

The clients now fall back to the requested scope when it is present, and otherwise to the previously granted scope (RFC 6749 section 6, where an omitted request scope equals the originally granted scope).

Added a regression test to each client covering a narrowed request with a response that omits scope.

AI-assisted; directed, reviewed and tested by the author.

Closes gh-20063

When a refresh token response omits the scope parameter, RFC 6749
section 5.1 defines the granted scope as identical to the scope
requested by the client. Both refresh token response clients fell back
to the previously granted scope instead, so a request that narrowed the
scope kept the wider scope in the resulting access token.

Fall back to the requested scope when it is present, and otherwise to
the previously granted scope.

Closes spring-projectsgh-20063

Signed-off-by: amalsaidov <amalsaidov@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 13, 2026
@ryujungkyun

Copy link
Copy Markdown

Have you had a chance to read the last part of the issue?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh token clients ignore requested scopes when the response omits scope

3 participants