|
@@ -124,7 +124,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
@@ -169,7 +169,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
@@ -199,7 +199,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
Set<String> requestedScopes = new HashSet<>(authorizedScopes);
|
|
Set<String> requestedScopes = new HashSet<>(authorizedScopes);
|
|
requestedScopes.remove("scope1");
|
|
requestedScopes.remove("scope1");
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, requestedScopes);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, requestedScopes, null);
|
|
|
|
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication =
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
(OAuth2AccessTokenAuthenticationToken) this.authenticationProvider.authenticate(authentication);
|
|
@@ -221,7 +221,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
Set<String> requestedScopes = new HashSet<>(authorizedScopes);
|
|
Set<String> requestedScopes = new HashSet<>(authorizedScopes);
|
|
requestedScopes.add("unauthorized");
|
|
requestedScopes.add("unauthorized");
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, requestedScopes);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, requestedScopes, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -235,7 +235,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
RegisteredClient registeredClient = TestRegisteredClients.registeredClient().build();
|
|
RegisteredClient registeredClient = TestRegisteredClients.registeredClient().build();
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- "invalid", clientPrincipal);
|
|
|
|
|
|
+ "invalid", clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -250,7 +250,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
TestingAuthenticationToken clientPrincipal = new TestingAuthenticationToken(
|
|
TestingAuthenticationToken clientPrincipal = new TestingAuthenticationToken(
|
|
registeredClient.getClientId(), registeredClient.getClientSecret());
|
|
registeredClient.getClientId(), registeredClient.getClientSecret());
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- "refresh-token", clientPrincipal);
|
|
|
|
|
|
+ "refresh-token", clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -265,7 +265,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(
|
|
registeredClient.getClientId(), registeredClient.getClientSecret(), ClientAuthenticationMethod.BASIC, null);
|
|
registeredClient.getClientId(), registeredClient.getClientSecret(), ClientAuthenticationMethod.BASIC, null);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- "refresh-token", clientPrincipal);
|
|
|
|
|
|
+ "refresh-token", clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -286,7 +286,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(
|
|
TestRegisteredClients.registeredClient2().build());
|
|
TestRegisteredClients.registeredClient2().build());
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -308,7 +308,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -331,7 +331,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
@@ -355,7 +355,7 @@ public class OAuth2RefreshTokenAuthenticationProviderTests {
|
|
|
|
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
OAuth2RefreshTokenAuthenticationToken authentication = new OAuth2RefreshTokenAuthenticationToken(
|
|
- authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal);
|
|
|
|
|
|
+ authorization.getRefreshToken().getToken().getTokenValue(), clientPrincipal, null, null);
|
|
|
|
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|
|
.isInstanceOf(OAuth2AuthenticationException.class)
|