Skip to content

Commit 548699d

Browse files
author
Steve Riesenberg
committed
PR changes, round 1
1 parent 39ab031 commit 548699d

File tree

12 files changed

+80
-46
lines changed

12 files changed

+80
-46
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OidcConfigurer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* @since 0.2.0
3737
* @see OAuth2AuthorizationServerConfigurer#oidc
3838
* @see OidcClientRegistrationEndpointConfigurer
39+
* @see OidcUserInfoEndpointConfigurer
3940
* @see OidcProviderConfigurationEndpointFilter
4041
*/
4142
public final class OidcConfigurer extends AbstractOAuth2Configurer {
@@ -66,7 +67,7 @@ public OidcConfigurer clientRegistrationEndpoint(Customizer<OidcClientRegistrati
6667
}
6768

6869
/**
69-
* Configures the OAuth 2.0 Protected Resource UserInfo Endpoint.
70+
* Configures the OpenID Connect 1.0 UserInfo Endpoint.
7071
*
7172
* @param userInfoEndpointCustomizer the {@link Customizer} providing access to the {@link OidcUserInfoEndpointConfigurer}
7273
* @return the {@link OidcConfigurer} for further configuration

oauth2-authorization-server/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OidcUserInfoEndpointConfigurer.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,23 @@
2121
import org.springframework.security.authentication.AuthenticationManager;
2222
import org.springframework.security.config.annotation.ObjectPostProcessor;
2323
import org.springframework.security.config.annotation.web.HttpSecurityBuilder;
24+
import org.springframework.security.oauth2.core.OAuth2AccessToken;
25+
import org.springframework.security.oauth2.core.OAuth2Token;
2426
import org.springframework.security.oauth2.core.authentication.OAuth2AuthenticationContext;
27+
import org.springframework.security.oauth2.core.oidc.OidcIdToken;
2528
import org.springframework.security.oauth2.core.oidc.OidcUserInfo;
29+
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
2630
import org.springframework.security.oauth2.server.authorization.config.ProviderSettings;
2731
import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationProvider;
32+
import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationToken;
2833
import org.springframework.security.oauth2.server.authorization.oidc.web.OidcUserInfoEndpointFilter;
2934
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
3035
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
3136
import org.springframework.security.web.util.matcher.OrRequestMatcher;
3237
import org.springframework.security.web.util.matcher.RequestMatcher;
3338

3439
/**
35-
* Configurer for OAuth 2.0 Protected Resource UserInfo Endpoint.
40+
* Configurer for OpenID Connect 1.0 UserInfo Endpoint.
3641
*
3742
* @author Steve Riesenberg
3843
* @since 0.2.1
@@ -54,6 +59,15 @@ public final class OidcUserInfoEndpointConfigurer extends AbstractOAuth2Configur
5459
* Sets the {@link Function} used to extract claims from an {@link OAuth2AuthenticationContext}
5560
* to an instance of {@link OidcUserInfo}.
5661
*
62+
* <p>
63+
* The {@link OAuth2AuthenticationContext} gives the mapper access to the {@link OidcUserInfoAuthenticationToken}.
64+
* In addition, the following context attributes are supported:
65+
* <ul>
66+
* <li>{@code OAuth2Token.class} - The {@link OAuth2Token} containing the bearer token used to make the request.</li>
67+
* <li>{@code OAuth2Authorization.class} - The {@link OAuth2Authorization} containing the {@link OidcIdToken} and
68+
* {@link OAuth2AccessToken} associated with the bearer token used to make the request.</li>
69+
* </ul>
70+
*
5771
* @param userInfoMapper the {@link Function} used to extract claims from an {@link OAuth2AuthenticationContext} to an instance of {@link OidcUserInfo}
5872
* @return the {@link OidcUserInfoEndpointConfigurer} for further configuration
5973
*/
@@ -74,7 +88,7 @@ <B extends HttpSecurityBuilder<B>> void init(B builder) {
7488
new OidcUserInfoAuthenticationProvider(
7589
OAuth2ConfigurerUtils.getAuthorizationService(builder));
7690
if (this.userInfoMapper != null) {
77-
oidcUserInfoAuthenticationProvider.setUserInfoMapper(userInfoMapper);
91+
oidcUserInfoAuthenticationProvider.setUserInfoMapper(this.userInfoMapper);
7892
}
7993
builder.authenticationProvider(postProcess(oidcUserInfoAuthenticationProvider));
8094
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcUserInfoHttpMessageConverter.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.security.oauth2.core.oidc.http.converter;
1717

18+
import java.time.Instant;
1819
import java.util.HashMap;
1920
import java.util.Map;
2021

@@ -36,7 +37,7 @@
3637
import org.springframework.util.Assert;
3738

3839
/**
39-
* A {@link HttpMessageConverter} for an {@link OidcUserInfo OAuth 2.0 Protected Resource UserInfo Response}.
40+
* A {@link HttpMessageConverter} for an {@link OidcUserInfo OpenID Connect UserInfo Request and Response}.
4041
*
4142
* @author Ido Salomon
4243
* @author Steve Riesenberg
@@ -52,7 +53,7 @@ public class OidcUserInfoHttpMessageConverter extends AbstractHttpMessageConvert
5253
private final GenericHttpMessageConverter<Object> jsonMessageConverter =
5354
HttpMessageConverters.getJsonMessageConverter();
5455

55-
private Converter<Map<String, Object>, OidcUserInfo> userInfoConverter = new OidcUserInfoConverter();
56+
private Converter<Map<String, Object>, OidcUserInfo> userInfoConverter = new MapOidcUserInfoConverter();
5657
private Converter<OidcUserInfo, Map<String, Object>> userInfoParametersConverter = OidcUserInfo::getClaims;
5758

5859
public OidcUserInfoHttpMessageConverter() {
@@ -92,7 +93,7 @@ protected void writeInternal(OidcUserInfo oidcUserInfo, HttpOutputMessage output
9293
);
9394
} catch (Exception ex) {
9495
throw new HttpMessageNotWritableException(
95-
"An error occurred writing the OAuth 2.0 Protected Resource UserInfo response: " + ex.getMessage(), ex);
96+
"An error occurred writing the UserInfo response: " + ex.getMessage(), ex);
9697
}
9798
}
9899

@@ -117,21 +118,24 @@ public final void setUserInfoConverter(Converter<Map<String, Object>, OidcUserIn
117118
*/
118119
public final void setUserInfoParametersConverter(
119120
Converter<OidcUserInfo, Map<String, Object>> userInfoParametersConverter) {
120-
Assert.notNull(userInfoParametersConverter, "oidcUserInfoParametersConverter cannot be null");
121+
Assert.notNull(userInfoParametersConverter, "userInfoParametersConverter cannot be null");
121122
this.userInfoParametersConverter = userInfoParametersConverter;
122123
}
123124

124-
private static final class OidcUserInfoConverter implements Converter<Map<String, Object>, OidcUserInfo> {
125+
private static final class MapOidcUserInfoConverter implements Converter<Map<String, Object>, OidcUserInfo> {
126+
125127
private static final ClaimConversionService CLAIM_CONVERSION_SERVICE = ClaimConversionService.getSharedInstance();
126128
private static final TypeDescriptor OBJECT_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Object.class);
127129
private static final TypeDescriptor BOOLEAN_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Boolean.class);
128130
private static final TypeDescriptor STRING_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(String.class);
131+
private static final TypeDescriptor INSTANT_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Instant.class);
129132
private static final TypeDescriptor STRING_OBJECT_MAP_DESCRIPTOR = TypeDescriptor.map(Map.class, STRING_TYPE_DESCRIPTOR, OBJECT_TYPE_DESCRIPTOR);
130133
private final ClaimTypeConverter claimTypeConverter;
131134

132-
private OidcUserInfoConverter() {
133-
Converter<Object, ?> stringConverter = getConverter(STRING_TYPE_DESCRIPTOR);
135+
private MapOidcUserInfoConverter() {
134136
Converter<Object, ?> booleanConverter = getConverter(BOOLEAN_TYPE_DESCRIPTOR);
137+
Converter<Object, ?> stringConverter = getConverter(STRING_TYPE_DESCRIPTOR);
138+
Converter<Object, ?> instantConverter = getConverter(INSTANT_TYPE_DESCRIPTOR);
135139
Converter<Object, ?> mapConverter = getConverter(STRING_OBJECT_MAP_DESCRIPTOR);
136140

137141
Map<String, Converter<Object, ?>> claimConverters = new HashMap<>();
@@ -154,7 +158,7 @@ private OidcUserInfoConverter() {
154158
claimConverters.put(StandardClaimNames.PHONE_NUMBER, stringConverter);
155159
claimConverters.put(StandardClaimNames.PHONE_NUMBER_VERIFIED, booleanConverter);
156160
claimConverters.put(StandardClaimNames.ADDRESS, mapConverter);
157-
claimConverters.put(StandardClaimNames.UPDATED_AT, stringConverter);
161+
claimConverters.put(StandardClaimNames.UPDATED_AT, instantConverter);
158162

159163
this.claimTypeConverter = new ClaimTypeConverter(claimConverters);
160164
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/config/ConfigurationSettingNames.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static final class Provider {
9595
public static final String OIDC_CLIENT_REGISTRATION_ENDPOINT = PROVIDER_SETTINGS_NAMESPACE.concat("oidc-client-registration-endpoint");
9696

9797
/**
98-
* Set the Provider's OAuth 2.0 Protected Resource UserInfo endpoint.
98+
* Set the Provider's OpenID Connect 1.0 UserInfo endpoint.
9999
*/
100100
public static final String OIDC_USER_INFO_ENDPOINT = PROVIDER_SETTINGS_NAMESPACE.concat("oidc-user-info-endpoint");
101101

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public String getOidcClientRegistrationEndpoint() {
9898
}
9999

100100
/**
101-
* Returns the Provider's OAuth 2.0 Protected Resource UserInfo endpoint. The default is {@code /userinfo}.
101+
* Returns the Provider's OpenID Connect 1.0 UserInfo endpoint. The default is {@code /userinfo}.
102102
*
103103
* @return the OpenID Connect 1.0 User Info endpoint
104104
*/
@@ -213,7 +213,7 @@ public Builder oidcClientRegistrationEndpoint(String oidcClientRegistrationEndpo
213213
}
214214

215215
/**
216-
* Sets the Provider's OAuth 2.0 Protected Resource UserInfo endpoint.
216+
* Sets the Provider's OpenID Connect 1.0 UserInfo endpoint.
217217
*
218218
* @param oidcUserInfoEndpoint the OpenID Connect 1.0 User Info endpoint
219219
* @return the {@link Builder} for further configuration

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/authentication/OidcUserInfoAuthenticationProvider.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.security.oauth2.core.OAuth2AccessToken;
3030
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
3131
import org.springframework.security.oauth2.core.OAuth2ErrorCodes;
32+
import org.springframework.security.oauth2.core.OAuth2Token;
3233
import org.springframework.security.oauth2.core.OAuth2TokenType;
3334
import org.springframework.security.oauth2.core.authentication.OAuth2AuthenticationContext;
3435
import org.springframework.security.oauth2.core.oidc.OidcIdToken;
@@ -41,7 +42,7 @@
4142
import org.springframework.util.Assert;
4243

4344
/**
44-
* An {@link AuthenticationProvider} implementation for OAuth 2.0 Protected Resource UserInfo.
45+
* An {@link AuthenticationProvider} implementation for OpenID Connect 1.0 UserInfo Endpoint.
4546
*
4647
* @author Steve Riesenberg
4748
* @since 0.2.1
@@ -52,7 +53,7 @@ public final class OidcUserInfoAuthenticationProvider implements AuthenticationP
5253

5354
private final OAuth2AuthorizationService authorizationService;
5455

55-
private Function<OAuth2AuthenticationContext, OidcUserInfo> userInfoMapper = new OidcUserInfoClaimsMapper();
56+
private Function<OAuth2AuthenticationContext, OidcUserInfo> userInfoMapper = new DefaultOidcUserInfoMapper();
5657

5758
/**
5859
* Constructs an {@code OidcUserInfoAuthenticationProvider} using the provided parameters.
@@ -69,7 +70,6 @@ public Authentication authenticate(Authentication authentication) throws Authent
6970
OidcUserInfoAuthenticationToken userInfoAuthentication =
7071
(OidcUserInfoAuthenticationToken) authentication;
7172

72-
// Validate the "initial" access token
7373
AbstractOAuth2TokenAuthenticationToken<?> accessTokenAuthentication = null;
7474
if (AbstractOAuth2TokenAuthenticationToken.class.isAssignableFrom(userInfoAuthentication.getPrincipal().getClass())) {
7575
accessTokenAuthentication = (AbstractOAuth2TokenAuthenticationToken<?>) userInfoAuthentication.getPrincipal();
@@ -91,7 +91,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
9191
throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_TOKEN);
9292
}
9393

94-
if (!isAuthorized(authorizedAccessToken)) {
94+
if (!authorizedAccessToken.getToken().getScopes().contains(OidcScopes.OPENID)) {
9595
throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INSUFFICIENT_SCOPE);
9696
}
9797

@@ -101,9 +101,10 @@ public Authentication authenticate(Authentication authentication) throws Authent
101101
}
102102

103103
Map<Object, Object> context = new HashMap<>();
104+
context.put(OAuth2Token.class, accessTokenAuthentication.getToken());
104105
context.put(OAuth2Authorization.class, authorization);
105106
OAuth2AuthenticationContext authenticationContext = new OAuth2AuthenticationContext(
106-
accessTokenAuthentication, context);
107+
userInfoAuthentication, context);
107108

108109
OidcUserInfo userInfo = this.userInfoMapper.apply(authenticationContext);
109110
return new OidcUserInfoAuthenticationToken(accessTokenAuthentication, userInfo);
@@ -118,18 +119,23 @@ public boolean supports(Class<?> authentication) {
118119
* Sets the {@link Function} used when mapping from an {@link OAuth2AuthenticationContext}
119120
* to an instance of {@link OidcUserInfo} for the UserInfo response.
120121
*
122+
* <p>
123+
* The {@link OAuth2AuthenticationContext} gives the mapper access to the {@link OidcUserInfoAuthenticationToken}.
124+
* In addition, the following context attributes are supported:
125+
* <ul>
126+
* <li>{@code OAuth2Token.class} - The {@link OAuth2Token} containing the bearer token used to make the request.</li>
127+
* <li>{@code OAuth2Authorization.class} - The {@link OAuth2Authorization} containing the {@link OidcIdToken} and
128+
* {@link OAuth2AccessToken} associated with the bearer token used to make the request.</li>
129+
* </ul>
130+
*
121131
* @param userInfoMapper the {@link Function} used when mapping from an {@link OAuth2AuthenticationContext}
122132
*/
123133
public void setUserInfoMapper(Function<OAuth2AuthenticationContext, OidcUserInfo> userInfoMapper) {
124134
Assert.notNull(userInfoMapper, "userInfoMapper cannot be null");
125135
this.userInfoMapper = userInfoMapper;
126136
}
127137

128-
private static boolean isAuthorized(OAuth2Authorization.Token<OAuth2AccessToken> authorizedAccessToken) {
129-
return authorizedAccessToken.getToken().getScopes().contains(OidcScopes.OPENID);
130-
}
131-
132-
private static final class OidcUserInfoClaimsMapper implements Function<OAuth2AuthenticationContext, OidcUserInfo> {
138+
private static final class DefaultOidcUserInfoMapper implements Function<OAuth2AuthenticationContext, OidcUserInfo> {
133139

134140
private static final List<String> EMAIL_CLAIMS = Arrays.asList(
135141
StandardClaimNames.EMAIL,

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/authentication/OidcUserInfoAuthenticationToken.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919

2020
import org.springframework.security.authentication.AbstractAuthenticationToken;
2121
import org.springframework.security.core.Authentication;
22+
import org.springframework.security.oauth2.core.Version;
2223
import org.springframework.security.oauth2.core.oidc.OidcUserInfo;
2324
import org.springframework.util.Assert;
2425

2526
/**
26-
* An {@link Authentication} implementation used for OAuth 2.0 Protected Resource UserInfo.
27+
* An {@link Authentication} implementation used for OpenID Connect 1.0 UserInfo Endpoint.
2728
*
2829
* @author Steve Riesenberg
2930
* @since 0.2.1
@@ -33,27 +34,34 @@
3334
*/
3435
public class OidcUserInfoAuthenticationToken extends AbstractAuthenticationToken {
3536

37+
private static final long serialVersionUID = Version.SERIAL_VERSION_UID;
38+
3639
private final Authentication principal;
3740
private final OidcUserInfo userInfo;
3841

3942
/**
4043
* Constructs an {@code OidcUserInfoAuthenticationToken} using the provided parameters.
4144
*
42-
* @param principal the authenticatedion principal
45+
* @param principal the authenticated principal
4346
*/
4447
public OidcUserInfoAuthenticationToken(Authentication principal) {
45-
this(principal, null);
48+
super(Collections.emptyList());
49+
Assert.notNull(principal, "principal cannot be null");
50+
this.principal = principal;
51+
this.userInfo = null;
52+
setAuthenticated(false);
4653
}
4754

4855
/**
4956
* Constructs an {@code OidcUserInfoAuthenticationToken} using the provided parameters.
5057
*
51-
* @param principal the authenticatedion principal
52-
* @param userInfo The UserInfo of the id token
58+
* @param principal the authenticated principal
59+
* @param userInfo the UserInfo claims
5360
*/
5461
public OidcUserInfoAuthenticationToken(Authentication principal, OidcUserInfo userInfo) {
5562
super(Collections.emptyList());
5663
Assert.notNull(principal, "principal cannot be null");
64+
Assert.notNull(userInfo, "userInfo cannot be null");
5765
this.principal = principal;
5866
this.userInfo = userInfo;
5967
setAuthenticated(principal.isAuthenticated());
@@ -66,15 +74,15 @@ public Object getPrincipal() {
6674

6775
@Override
6876
public Object getCredentials() {
69-
return null;
77+
return "";
7078
}
7179

7280
/**
73-
* Returns the user info associated with the authorized access token.
81+
* Returns the UserInfo claims.
7482
*
75-
* @return the user info associated with the authorized access token
83+
* @return the UserInfo claims
7684
*/
7785
public OidcUserInfo getUserInfo() {
78-
return userInfo;
86+
return this.userInfo;
7987
}
8088
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/web/OidcUserInfoEndpointFilter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import org.springframework.web.filter.OncePerRequestFilter;
4545

4646
/**
47-
* A {@code Filter} that processes OAuth 2.0 Protected Resource UserInfo requests.
47+
* A {@code Filter} that processes OpenID Connect 1.0 UserInfo Requests.
4848
*
4949
* @author Ido Salomon
5050
* @author Steve Riesenberg
@@ -55,7 +55,7 @@
5555
public final class OidcUserInfoEndpointFilter extends OncePerRequestFilter {
5656

5757
/**
58-
* The default endpoint {@code URI} for OAuth 2.0 Protected Resource UserInfo requests.
58+
* The default endpoint {@code URI} for OpenID Connect 1.0 UserInfo Requests.
5959
*/
6060
private static final String DEFAULT_OIDC_USER_INFO_ENDPOINT_URI = "/userinfo";
6161

@@ -80,11 +80,11 @@ public OidcUserInfoEndpointFilter(AuthenticationManager authenticationManager) {
8080
* Constructs an {@code OidcUserInfoEndpointFilter} using the provided parameters.
8181
*
8282
* @param authenticationManager the authentication manager
83-
* @param userInfoEndpointUri the endpoint {@code URI} for OAuth 2.0 Protected Resource UserInfo requests
83+
* @param userInfoEndpointUri the endpoint {@code URI} for OpenID Connect 1.0 UserInfo Requests
8484
*/
8585
public OidcUserInfoEndpointFilter(AuthenticationManager authenticationManager, String userInfoEndpointUri) {
8686
Assert.notNull(authenticationManager, "authenticationManager cannot be null");
87-
Assert.notNull(userInfoEndpointUri, "userInfoEndpointUri cannot be null");
87+
Assert.hasText(userInfoEndpointUri, "userInfoEndpointUri cannot be empty");
8888
this.authenticationManager = authenticationManager;
8989
this.userInfoEndpointMatcher = new OrRequestMatcher(
9090
new AntPathRequestMatcher(userInfoEndpointUri, HttpMethod.GET.name()),
@@ -115,7 +115,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
115115
} catch (Exception ex) {
116116
OAuth2Error error = new OAuth2Error(
117117
OAuth2ErrorCodes.INVALID_REQUEST,
118-
"OAuth 2.0 Protected Resource UserInfo Error: " + ex.getMessage(),
118+
"OpenID Connect 1.0 UserInfo Error: " + ex.getMessage(),
119119
"https://openid.net/specs/openid-connect-core-1_0.html#UserInfoError");
120120
sendErrorResponse(response, error);
121121
} finally {

oauth2-authorization-server/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OidcUserInfoTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.springframework.security.config.test.SpringTestRule;
3939
import org.springframework.security.oauth2.core.OAuth2AccessToken;
4040
import org.springframework.security.oauth2.core.oidc.OidcIdToken;
41+
import org.springframework.security.oauth2.core.oidc.OidcScopes;
4142
import org.springframework.security.oauth2.core.oidc.OidcUserInfo;
4243
import org.springframework.security.oauth2.core.oidc.StandardClaimNames;
4344
import org.springframework.security.oauth2.jose.TestJwks;
@@ -66,14 +67,14 @@
6667
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
6768

6869
/**
69-
* Integration tests for the OpenID User Info endpoint.
70+
* Integration tests for the OpenID Connect 1.0 UserInfo endpoint.
7071
*
7172
* @author Steve Riesenberg
7273
*/
7374
public class OidcUserInfoTests {
7475
private static final String DEFAULT_OIDC_USER_INFO_ENDPOINT_URI = "/userinfo";
7576
private static final List<String> OPENID_USER_INFO_SCOPES = Arrays.asList(
76-
"openid", "address", "email", "phone", "profile"
77+
OidcScopes.OPENID, OidcScopes.ADDRESS, OidcScopes.EMAIL, OidcScopes.PHONE, OidcScopes.PROFILE
7778
);
7879

7980
@Rule

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcUserInfoHttpMessageConverterTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void writeInternalWhenWriteFailsThenThrowsException() {
190190

191191
assertThatExceptionOfType(HttpMessageNotWritableException.class)
192192
.isThrownBy(() -> this.messageConverter.writeInternal(userInfo, outputMessage))
193-
.withMessageContaining("An error occurred writing the OAuth 2.0 Protected Resource UserInfo response")
193+
.withMessageContaining("An error occurred writing the UserInfo response")
194194
.withMessageContaining(errorMessage);
195195
}
196196

0 commit comments

Comments
 (0)