客户端凭证交付式无法正常使用Apache奥尔图客户端库发出? [英] Client credential grant type is not properly sent with Apache Oltu client library?
问题描述
我想实现Apache的奥尔图使用OAuthClientRequest OAuth用户端。它似乎是它在邮件正文根据该规范发送客户端证书没有在基本认证头。我不知道,我可能已经错过了在code一些事情。
code
OAuthClientRequest.tokenLocation(HTTP://本地主机:8081 /令牌)
.setGrantType(GrantType.CLIENT_CREDENTIALS)
.setClientId(clientKey)
.setClientSecret(clientSecret)
.buildBodyMessage();
请求
POST /令牌HTTP / 1.1
内容类型:应用程序/ x-WWW的形式urlen codeD
缓存控制:无缓存
编译:无缓存
用户代理:的Java / 1.6.0_29
主持人:127.0.0.1:8081
接受:text / html的,图像/ GIF,图像/ JPEG,*; Q = 2, / 的; Q = 0.2
连接:保持活动
内容长度:127
client_secret=f921854d-f70b-4180-9fdd-3a55032103cc&grant_type=client_credentials&client_id=3f3b4092-7576-4b26-8135-980db7864c2
块引用>解决方案您可能需要修改
buildBodyMessage()
与buildQueryMessage()
I tried to implement an OAuth client using OAuthClientRequest in Apache Oltu. And it seems to be that it is sending client credentials in the message body not in the Basic Auth headers according to the spec. I am not sure, I may have missed some thing in the code.
Code
OAuthClientRequest.tokenLocation("http://localhost:8081/token") .setGrantType(GrantType.CLIENT_CREDENTIALS) .setClientId(clientKey) .setClientSecret(clientSecret) .buildBodyMessage();
Request
POST /token HTTP/1.1 Content-Type: application/x-www-form-urlencoded Cache-Control: no-cache Pragma: no-cache User-Agent: Java/1.6.0_29 Host: 127.0.0.1:8081 Accept: text/html, image/gif, image/jpeg, *; q=.2, /; q=.2 Connection: keep-alive Content-Length: 127
client_secret=f921854d-f70b-4180-9fdd-3a55032103cc&grant_type=client_credentials&client_id=3f3b4092-7576-4b26-8135-980db7864c2
解决方案You might want to change
buildBodyMessage()
withbuildQueryMessage()
这篇关于客户端凭证交付式无法正常使用Apache奥尔图客户端库发出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!