From fc553bf19aa24e5bc5363d92a7f215609a877ec4 Mon Sep 17 00:00:00 2001 From: Steve Riesenberg Date: Mon, 9 Aug 2021 15:30:41 -0500 Subject: [PATCH] Add gh-10130 to tests --- ...ientReactiveAuthorizationCodeTokenResponseClientTests.java | 4 ++++ ...ientReactiveClientCredentialsTokenResponseClientTests.java | 4 ++++ .../WebClientReactivePasswordTokenResponseClientTests.java | 4 ++++ ...WebClientReactiveRefreshTokenTokenResponseClientTests.java | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java index dad25d9723..37d3768a8c 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java @@ -343,18 +343,21 @@ public class WebClientReactiveAuthorizationCodeTokenResponseClientTests { return new OAuth2AuthorizationCodeGrantRequest(registration, authorizationExchange); } + // gh-10130 @Test public void setHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.setHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void addHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.addHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void convertWhenHeadersConverterAddedThenCalled() throws Exception { OAuth2AuthorizationCodeGrantRequest request = authorizationCodeGrantRequest(); @@ -380,6 +383,7 @@ public class WebClientReactiveAuthorizationCodeTokenResponseClientTests { assertThat(actualRequest.getHeader("custom-header-name")).isEqualTo("custom-header-value"); } + // gh-10130 @Test public void convertWhenHeadersConverterSetThenCalled() throws Exception { OAuth2AuthorizationCodeGrantRequest request = authorizationCodeGrantRequest(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java index 6409583cc7..28acf6bdfc 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java @@ -214,18 +214,21 @@ public class WebClientReactiveClientCredentialsTokenResponseClientTests { this.server.enqueue(response); } + // gh-10130 @Test public void setHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.client.setHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void addHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.client.addHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void convertWhenHeadersConverterAddedThenCalled() throws Exception { OAuth2ClientCredentialsGrantRequest request = new OAuth2ClientCredentialsGrantRequest( @@ -251,6 +254,7 @@ public class WebClientReactiveClientCredentialsTokenResponseClientTests { assertThat(actualRequest.getHeader("custom-header-name")).isEqualTo("custom-header-value"); } + // gh-10130 @Test public void convertWhenHeadersConverterSetThenCalled() throws Exception { OAuth2ClientCredentialsGrantRequest request = new OAuth2ClientCredentialsGrantRequest( diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java index 7f9c071278..aabd789bc4 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java @@ -218,18 +218,21 @@ public class WebClientReactivePasswordTokenResponseClientTests { // @formatter:on } + // gh-10130 @Test public void setHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.setHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void addHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.addHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void convertWhenHeadersConverterAddedThenCalled() throws Exception { OAuth2PasswordGrantRequest request = new OAuth2PasswordGrantRequest(this.clientRegistrationBuilder.build(), @@ -256,6 +259,7 @@ public class WebClientReactivePasswordTokenResponseClientTests { assertThat(actualRequest.getHeader("custom-header-name")).isEqualTo("custom-header-value"); } + // gh-10130 @Test public void convertWhenHeadersConverterSetThenCalled() throws Exception { OAuth2PasswordGrantRequest request = new OAuth2PasswordGrantRequest(this.clientRegistrationBuilder.build(), diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java index b93800b68d..e94e1124ce 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java @@ -221,18 +221,21 @@ public class WebClientReactiveRefreshTokenTokenResponseClientTests { // @formatter:on } + // gh-10130 @Test public void setHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.setHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void addHeadersConverterWhenNullThenThrowIllegalArgumentException() { assertThatIllegalArgumentException().isThrownBy(() -> this.tokenResponseClient.addHeadersConverter(null)) .withMessage("headersConverter cannot be null"); } + // gh-10130 @Test public void convertWhenHeadersConverterAddedThenCalled() throws Exception { OAuth2RefreshTokenGrantRequest request = new OAuth2RefreshTokenGrantRequest( @@ -259,6 +262,7 @@ public class WebClientReactiveRefreshTokenTokenResponseClientTests { assertThat(actualRequest.getHeader("custom-header-name")).isEqualTo("custom-header-value"); } + // gh-10130 @Test public void convertWhenHeadersConverterSetThenCalled() throws Exception { OAuth2RefreshTokenGrantRequest request = new OAuth2RefreshTokenGrantRequest(