From dbf0c6630186b4df592e8832de1e4cd27e72e175 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Wed, 12 Jul 2023 14:15:31 -0600 Subject: [PATCH] Fix Client Authentication Method Error Message Closes gh-13496 --- ...stractWebClientReactiveOAuth2AccessTokenResponseClient.java | 3 ++- ...ntAuthenticationMethodValidatingRequestEntityConverter.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java index fff6222bb6f..0b2403e8975 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java @@ -115,7 +115,8 @@ private void validateClientAuthenticationMethod(T grantRequest) { if (!supportedClientAuthenticationMethod) { throw new IllegalArgumentException(String.format( "This class supports `client_secret_basic`, `client_secret_post`, and `none` by default. Client [%s] is using [%s] instead. Please use a supported client authentication method, or use `set/addParametersConverter` or `set/addHeadersConverter` to supply an instance that supports [%s].", - clientRegistration.getRegistrationId(), clientAuthenticationMethod, clientAuthenticationMethod)); + clientRegistration.getRegistrationId(), clientAuthenticationMethod.getValue(), + clientAuthenticationMethod.getValue())); } } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/ClientAuthenticationMethodValidatingRequestEntityConverter.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/ClientAuthenticationMethodValidatingRequestEntityConverter.java index 1c6068b08bb..0c2537d896e 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/ClientAuthenticationMethodValidatingRequestEntityConverter.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/ClientAuthenticationMethodValidatingRequestEntityConverter.java @@ -41,7 +41,7 @@ public RequestEntity convert(T grantRequest) { || clientAuthenticationMethod.equals(ClientAuthenticationMethod.CLIENT_SECRET_POST); Assert.isTrue(supportedClientAuthenticationMethod, () -> String.format( "This class supports `client_secret_basic`, `client_secret_post`, and `none` by default. Client [%s] is using [%s] instead. Please use a supported client authentication method, or use `setRequestEntityConverter` to supply an instance that supports [%s].", - registrationId, clientAuthenticationMethod, clientAuthenticationMethod)); + registrationId, clientAuthenticationMethod.getValue(), clientAuthenticationMethod.getValue())); return this.delegate.convert(grantRequest); }