客户端凭证交付式无法正常使用Apache奥尔图客户端库发出? [英] Client credential grant type is not properly sent with Apache Oltu client library?

查看:191
本文介绍了客户端凭证交付式无法正常使用Apache奥尔图客户端库发出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现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() with buildQueryMessage()

这篇关于客户端凭证交付式无法正常使用Apache奥尔图客户端库发出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆