|
@@ -42,7 +42,6 @@ import org.springframework.security.oauth2.jwt.Jwt;
|
|
|
import org.springframework.security.oauth2.jwt.JwtClaimsSet;
|
|
|
import org.springframework.security.oauth2.jwt.JwtEncoder;
|
|
|
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
|
|
|
-import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationAttributeNames;
|
|
|
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
|
|
import org.springframework.security.oauth2.server.authorization.TestOAuth2Authorizations;
|
|
|
import org.springframework.security.oauth2.server.authorization.TokenType;
|
|
@@ -185,7 +184,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri() + "-invalid", null);
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
@@ -208,7 +207,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri(), null);
|
|
|
|
|
@@ -228,7 +227,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri(), null);
|
|
|
|
|
@@ -254,7 +253,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
JwtClaimsSet jwtClaimsSet = jwtClaimsSetCaptor.getValue();
|
|
|
|
|
|
Set<String> scopes = jwtClaimsSet.getClaim(OAuth2ParameterNames.SCOPE);
|
|
|
- assertThat(scopes).isEqualTo(authorization.getAttribute(OAuth2AuthorizationAttributeNames.AUTHORIZED_SCOPES));
|
|
|
+ assertThat(scopes).isEqualTo(authorization.getAttribute(OAuth2Authorization.AUTHORIZED_SCOPE_ATTRIBUTE_NAME));
|
|
|
assertThat(jwtClaimsSet.getSubject()).isEqualTo(authorization.getPrincipalName());
|
|
|
|
|
|
ArgumentCaptor<OAuth2Authorization> authorizationCaptor = ArgumentCaptor.forClass(OAuth2Authorization.class);
|
|
@@ -279,7 +278,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri(), null);
|
|
|
|
|
@@ -345,7 +344,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri(), null);
|
|
|
|
|
@@ -383,7 +382,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
|
OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
|
|
|
- OAuth2AuthorizationAttributeNames.AUTHORIZATION_REQUEST);
|
|
|
+ OAuth2AuthorizationRequest.class.getName());
|
|
|
OAuth2AuthorizationCodeAuthenticationToken authentication =
|
|
|
new OAuth2AuthorizationCodeAuthenticationToken(AUTHORIZATION_CODE, clientPrincipal, authorizationRequest.getRedirectUri(), null);
|
|
|
|