Skip to content

Commit 50b77ff

Browse files
committed
revert auth scopes changes
1 parent b8b6961 commit 50b77ff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2ClientCredentialsAuthenticationProvider.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.security.oauth2.server.authorization.authentication;
1717

18+
import java.util.Set;
1819
import java.util.function.Consumer;
1920

2021
import org.apache.commons.logging.Log;
@@ -104,12 +105,14 @@ public Authentication authenticate(Authentication authentication) throws Authent
104105
this.logger.trace("Validated token request parameters");
105106
}
106107

108+
Set<String> authorizedScopes = Set.copyOf(clientCredentialsAuthentication.getScopes());
109+
107110
// @formatter:off
108111
OAuth2TokenContext tokenContext = DefaultOAuth2TokenContext.builder()
109112
.registeredClient(registeredClient)
110113
.principal(clientPrincipal)
111114
.authorizationServerContext(AuthorizationServerContextHolder.getContext())
112-
.authorizedScopes(clientCredentialsAuthentication.getScopes())
115+
.authorizedScopes(authorizedScopes)
113116
.tokenType(OAuth2TokenType.ACCESS_TOKEN)
114117
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
115118
.authorizationGrant(clientCredentialsAuthentication)
@@ -135,7 +138,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
135138
OAuth2Authorization.Builder authorizationBuilder = OAuth2Authorization.withRegisteredClient(registeredClient)
136139
.principalName(clientPrincipal.getName())
137140
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
138-
.authorizedScopes(tokenContext.getAuthorizedScopes());
141+
.authorizedScopes(authorizedScopes);
139142
// @formatter:on
140143
if (generatedAccessToken instanceof ClaimAccessor) {
141144
authorizationBuilder.token(accessToken, (metadata) ->

0 commit comments

Comments
 (0)