Skip to content

Commit a77ef9e

Browse files
committed
Add ClientAuthenticationMethod#toString
Closes gh-13497
1 parent 80a0ade commit a77ef9e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ private void validateClientAuthenticationMethod(T grantRequest) {
115115
if (!supportedClientAuthenticationMethod) {
116116
throw new IllegalArgumentException(String.format(
117117
"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].",
118-
clientRegistration.getRegistrationId(), clientAuthenticationMethod.getValue(),
119-
clientAuthenticationMethod.getValue()));
118+
clientRegistration.getRegistrationId(), clientAuthenticationMethod, clientAuthenticationMethod));
120119
}
121120
}
122121

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/ClientAuthenticationMethodValidatingRequestEntityConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public RequestEntity<?> convert(T grantRequest) {
4141
|| clientAuthenticationMethod.equals(ClientAuthenticationMethod.CLIENT_SECRET_POST);
4242
Assert.isTrue(supportedClientAuthenticationMethod, () -> String.format(
4343
"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].",
44-
registrationId, clientAuthenticationMethod.getValue(), clientAuthenticationMethod.getValue()));
44+
registrationId, clientAuthenticationMethod, clientAuthenticationMethod));
4545
return this.delegate.convert(grantRequest);
4646
}
4747

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ClientAuthenticationMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,9 @@ public int hashCode() {
9898
return getValue().hashCode();
9999
}
100100

101+
@Override
102+
public String toString() {
103+
return this.value;
104+
}
105+
101106
}

0 commit comments

Comments
 (0)