java - 如何更改 ClientCredentialsResourceDetails 发出的请求的内容类型?

标签 java spring-security oauth oauth-2.0 spring-security-oauth2

现在,我正在尝试更改将由 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/

相关文章:

java - 更清晰地访问静态字段和方法?

java - System.exit(0)之后还需要break吗?

spring - 如何使用多个相互调用的自定义过滤器?

rest - HTTP API : Communicating the need to authenticate to a third party

angularjs - 使用 MEAN.js Restful sessionless API 后端的 Oauth 社交登录

java - 抽屉导航未加载新布局的 .java

java - Java 中的尾调用优化

java - Spring MVC安全自动登录使用Cas服务器JASIG

Zuul 上的 Spring Security 预授权过滤器建立和共享 session

node.js - Passport.js twitter 身份验证导致 500 错误,req.session 未定义