【问题标题】:External URI Post Gettoken REST SPRING JAVA外部 URI Post Gettoken REST SPRING JAVA
【发布时间】:2018-09-07 02:25:55
【问题描述】:

有一个外部 URI 用于捕获带有 post 请求的令牌。在其正文中包含uaa-url, client ID, secret。我怎样才能获得令牌?其相关的 URI 类似于{{https:// token...}}/gettoken。并且此 URI 不在我的域中。 在restTemplate 实例上调用exchange 方法之前,我需要将此(bearer)token 添加到header

"uaaURL":"https://{{abc}}.{{de}}",
"clientID":"id-{{cid_value}}",
"clientSecret":"{{clientSecret_value}}",
"username":"value"
"samlAttributes":{
    "Groups":["{{}}"],
    "attribute1":["vaattr"]
 }

任何示例/链接等将不胜感激。

【问题讨论】:

    标签: java spring rest post oauth-2.0


    【解决方案1】:

    如果您需要实时获取该令牌,则需要真正获得对令牌服务的访问权限。但是,如果您只需要测试您的应用程序,您可以模拟请求并可以在此处创建 JWT 令牌: https://www.jsonwebtoken.io/

    【讨论】:

    • 有了上面的正文,我应该从令牌服务中获取令牌。使用来自外部 URI 的 POST 请求。 @小姐。齐亚
    • 试试这个格式:POST http://[tokenservicehost]/gettoken?client_id=[your_clientid]&client_secret=[your_clientsecret]&grant_type=password&username=[your_username]&password=[your_password]&response_type=token跨度>
    • 如果password 值不可用怎么办? @小姐。齐亚。我的身体里没有这个。
    • 然后使用相关的授权类型(client_credentials 看起来与您的情况相关)。有关详细信息,请查看此链接:alexbilbie.com/guide-to-oauth-2-grants
    猜你喜欢
    • 2019-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-06
    • 2012-10-04
    • 2015-04-24
    • 1970-01-01
    相关资源
    最近更新 更多