现在,我正在尝试更改将由 ClientCredentialsResourceDetails 提出的请求的内容类型
(org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails
)
预期内容类型:-,即表单/数据或多部分/表单数据
但现在我只能看到/做这个,
ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails();
resourceDetails.setClientAuthenticationScheme(AuthenticationScheme.header);
这段代码只允许我通过以下content-type
传递数据,
content-type : application/x-www-form-urlencoded
所以我想改变它。
谁能给我一个主意吗?如何做到这一点?
任何帮助感激...!!!
最佳答案
客户端凭据流程在 RFC 6749 中定义,“4.4. Client Credentials Grant”和“4.4.2. Access Token Request”如下所示。
The client makes a request to the token endpoint by adding the following parameters using the "application/x-www-form-urlencoded" format per Appendix B with a character encoding of UTF-8 in the HTTP request entity-body:
因此,期望 Spring Security 和其他 OAuth 客户端库提供使用客户端凭据流将 token 请求的 Content-Type 更改为除“application/x-www-for-urlencoded”之外的任何其他值的方法是没有希望的。
关于java - 如何更改 ClientCredentialsResourceDetails 发出的请求的内容类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42244868/