Fix registration access token cannot be deserialized
Change the authorized scopes Set from SingletonSet to UnmodifiableSet as there is no mixin registered for SingletonSet Closes gh-495
This commit is contained in:
@@ -21,6 +21,7 @@ import java.time.Instant;
|
|||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -218,7 +219,9 @@ public final class OidcClientRegistrationAuthenticationProvider implements Authe
|
|||||||
private OAuth2Authorization registerAccessToken(RegisteredClient registeredClient) {
|
private OAuth2Authorization registerAccessToken(RegisteredClient registeredClient) {
|
||||||
JoseHeader headers = JwtUtils.headers().build();
|
JoseHeader headers = JwtUtils.headers().build();
|
||||||
|
|
||||||
Set<String> authorizedScopes = Collections.singleton(DEFAULT_CLIENT_CONFIGURATION_AUTHORIZED_SCOPE);
|
Set<String> authorizedScopes = new HashSet<>();
|
||||||
|
authorizedScopes.add(DEFAULT_CLIENT_CONFIGURATION_AUTHORIZED_SCOPE);
|
||||||
|
authorizedScopes = Collections.unmodifiableSet(authorizedScopes);
|
||||||
|
|
||||||
JwtClaimsSet claims = JwtUtils.accessTokenClaims(
|
JwtClaimsSet claims = JwtUtils.accessTokenClaims(
|
||||||
registeredClient, this.providerSettings.getIssuer(), registeredClient.getClientId(), authorizedScopes)
|
registeredClient, this.providerSettings.getIssuer(), registeredClient.getClientId(), authorizedScopes)
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ import org.springframework.security.oauth2.core.oidc.http.converter.OidcClientRe
|
|||||||
import org.springframework.security.oauth2.jose.TestJwks;
|
import org.springframework.security.oauth2.jose.TestJwks;
|
||||||
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
|
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
|
||||||
import org.springframework.security.oauth2.jwt.JwtDecoder;
|
import org.springframework.security.oauth2.jwt.JwtDecoder;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||||
import org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository;
|
import org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository;
|
||||||
import org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository.RegisteredClientParametersMapper;
|
import org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository.RegisteredClientParametersMapper;
|
||||||
import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
|
import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
|
||||||
@@ -323,6 +325,11 @@ public class OidcClientRegistrationTests {
|
|||||||
return registeredClientRepository;
|
return registeredClientRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
OAuth2AuthorizationService authorizationService(JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) {
|
||||||
|
return new JdbcOAuth2AuthorizationService(jdbcOperations, registeredClientRepository);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
JdbcOperations jdbcOperations() {
|
JdbcOperations jdbcOperations() {
|
||||||
return new JdbcTemplate(db);
|
return new JdbcTemplate(db);
|
||||||
|
|||||||
Reference in New Issue
Block a user