|
42 | 42 | import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager; |
43 | 43 | import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider; |
44 | 44 | import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder; |
| 45 | +import org.springframework.security.oauth2.client.endpoint.DefaultOAuth2TokenRequestParametersConverter; |
45 | 46 | import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient; |
46 | 47 | import org.springframework.security.oauth2.client.endpoint.OAuth2ClientCredentialsGrantRequest; |
47 | 48 | import org.springframework.security.oauth2.client.endpoint.RestClientClientCredentialsTokenResponseClient; |
|
50 | 51 | import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager; |
51 | 52 | import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository; |
52 | 53 | import org.springframework.security.oauth2.client.web.client.OAuth2ClientHttpRequestInterceptor; |
53 | | -import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; |
54 | 54 | import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter; |
55 | | -import org.springframework.util.LinkedMultiValueMap; |
56 | | -import org.springframework.util.MultiValueMap; |
57 | 55 | import org.springframework.web.client.RestClient; |
58 | 56 |
|
59 | 57 | /** |
@@ -206,12 +204,7 @@ private static OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantReque |
206 | 204 | RestClient restClient) { |
207 | 205 | RestClientClientCredentialsTokenResponseClient clientCredentialsTokenResponseClient = |
208 | 206 | new RestClientClientCredentialsTokenResponseClient(); |
209 | | - clientCredentialsTokenResponseClient.addParametersConverter(authorizationGrantRequest -> { |
210 | | - MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>(); |
211 | | - // client_id parameter is required for tls_client_auth method |
212 | | - parameters.add(OAuth2ParameterNames.CLIENT_ID, authorizationGrantRequest.getClientRegistration().getClientId()); |
213 | | - return parameters; |
214 | | - }); |
| 207 | + clientCredentialsTokenResponseClient.setParametersConverter(new DefaultOAuth2TokenRequestParametersConverter<>()); |
215 | 208 | clientCredentialsTokenResponseClient.setRestClient(restClient); |
216 | 209 |
|
217 | 210 | return clientCredentialsTokenResponseClient; |
|
0 commit comments