Rename to ServerOAuth2AuthorizedClientExchangeFilterFunction
Rename OAuth2AuthorizedClientExchangeFilterFunction to ServerOAuth2AuthorizedClientExchangeFilterFunction-> Issue: gh-5386
This commit is contained in:
parent
1b79bbed7f
commit
9ababf4168
|
@ -57,7 +57,7 @@ import static org.springframework.security.web.http.SecurityHeaders.bearerToken;
|
|||
* @author Rob Winch
|
||||
* @since 5.1
|
||||
*/
|
||||
public final class OAuth2AuthorizedClientExchangeFilterFunction implements ExchangeFilterFunction {
|
||||
public final class ServerOAuth2AuthorizedClientExchangeFilterFunction implements ExchangeFilterFunction {
|
||||
/**
|
||||
* The request attribute name used to locate the {@link OAuth2AuthorizedClient}.
|
||||
*/
|
||||
|
@ -69,9 +69,9 @@ public final class OAuth2AuthorizedClientExchangeFilterFunction implements Excha
|
|||
|
||||
private ReactiveOAuth2AuthorizedClientService authorizedClientService;
|
||||
|
||||
public OAuth2AuthorizedClientExchangeFilterFunction() {}
|
||||
public ServerOAuth2AuthorizedClientExchangeFilterFunction() {}
|
||||
|
||||
public OAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientService authorizedClientService) {
|
||||
public ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientService authorizedClientService) {
|
||||
this.authorizedClientService = authorizedClientService;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public final class OAuth2AuthorizedClientExchangeFilterFunction implements Excha
|
|||
*
|
||||
* <ul>
|
||||
* <li>The ReactiveOAuth2AuthorizedClientService on the
|
||||
* {@link OAuth2AuthorizedClientExchangeFilterFunction} is not null</li>
|
||||
* {@link ServerOAuth2AuthorizedClientExchangeFilterFunction} is not null</li>
|
||||
* <li>A refresh token is present on the OAuth2AuthorizedClient</li>
|
||||
* <li>The access token will be expired in
|
||||
* {@link #setAccessTokenExpiresSkew(Duration)}</li>
|
|
@ -62,18 +62,18 @@ import static org.mockito.ArgumentMatchers.eq;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.http.HttpMethod.GET;
|
||||
import static org.springframework.security.oauth2.client.web.reactive.function.client.OAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
|
||||
import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
* @since 5.1
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class OAuth2AuthorizedClientExchangeFilterFunctionTests {
|
||||
public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests {
|
||||
@Mock
|
||||
private ReactiveOAuth2AuthorizedClientService authorizedClientService;
|
||||
|
||||
private OAuth2AuthorizedClientExchangeFilterFunction function = new OAuth2AuthorizedClientExchangeFilterFunction();
|
||||
private ServerOAuth2AuthorizedClientExchangeFilterFunction function = new ServerOAuth2AuthorizedClientExchangeFilterFunction();
|
||||
|
||||
private MockExchangeFunction exchange = new MockExchangeFunction();
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class OAuth2AuthorizedClientExchangeFilterFunctionTests {
|
|||
this.accessToken.getTokenValue(),
|
||||
issuedAt,
|
||||
accessTokenExpiresAt);
|
||||
this.function = new OAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
this.function = new ServerOAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
|
||||
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", issuedAt, refreshTokenExpiresAt);
|
||||
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.github,
|
||||
|
@ -200,7 +200,7 @@ public class OAuth2AuthorizedClientExchangeFilterFunctionTests {
|
|||
this.accessToken.getTokenValue(),
|
||||
issuedAt,
|
||||
accessTokenExpiresAt);
|
||||
this.function = new OAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
this.function = new ServerOAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
|
||||
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", issuedAt, refreshTokenExpiresAt);
|
||||
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.github,
|
||||
|
@ -232,7 +232,7 @@ public class OAuth2AuthorizedClientExchangeFilterFunctionTests {
|
|||
|
||||
@Test
|
||||
public void filterWhenRefreshTokenNullThenShouldRefreshFalse() {
|
||||
this.function = new OAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
this.function = new ServerOAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
|
||||
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.github,
|
||||
"principalName", this.accessToken);
|
||||
|
@ -254,7 +254,7 @@ public class OAuth2AuthorizedClientExchangeFilterFunctionTests {
|
|||
|
||||
@Test
|
||||
public void filterWhenNotExpiredThenShouldRefreshFalse() {
|
||||
this.function = new OAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
this.function = new ServerOAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientService);
|
||||
|
||||
OAuth2RefreshToken refreshToken = new OAuth2RefreshToken("refresh-token", this.accessToken.getIssuedAt(), this.accessToken.getExpiresAt());
|
||||
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(this.github,
|
|
@ -18,7 +18,7 @@ package sample.config;
|
|||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.oauth2.client.web.reactive.function.client.OAuth2AuthorizedClientExchangeFilterFunction;
|
||||
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ public class WebClientConfig {
|
|||
@Bean
|
||||
WebClient webClient() {
|
||||
return WebClient.builder()
|
||||
.filter(new OAuth2AuthorizedClientExchangeFilterFunction())
|
||||
.filter(new ServletOAuth2AuthorizedClientExchangeFilterFunction())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.security.oauth2.client.web.reactive.function.client.OAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
|
||||
import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
|
||||
|
||||
/**
|
||||
* @author Joe Grandja
|
||||
|
|
Loading…
Reference in New Issue