执行 wso2is REST API [英] Executing wso2is REST API

查看:17
本文介绍了执行 wso2is REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调用 wso2is Tenant API,但我无法获得正确的身份验证步骤.我正在使用

I want to call wso2is Tenant API, but I cannot get correct authentication steps. I am generating access token using

curl -v -X POST -H "Authorization: Basic <auth>" -k -d "grant_type=password&username=admin&password=admin" -H "Content-Type:application/x-www-form-urlencoded" https://localhost:9443/oauth2/token

但在执行任何租户 API 端点时未从服务器获得任何响应.

But not getting any response from the server when executing any of Tenant API endpoints.

推荐答案

  1. 创建服务提供者并将其配置为 OIDC 客户端应用程序.(1)

使用以下命令生成访问令牌.

Generate the access token using the following command.

curl -u <CLIENT_ID>:<CLIENT_SECRET> -k -d "grant_type=password&username=<USERNAME>&password=<PASSWORD>&scope=<REQUIRED_SCOPE>" -H "Content-Type:application/x-www-form-urlencoded" https://<IS-HOST>:<PORT>/oauth2/token

你必须替换.更多信息:(2)

You have to replace <CLIENT_ID>, <CLIENT_SECRET>, <USERNAME>, <PASSWORD>, <REQUIRED_SCOPE>, <IS-HOST>, <PORT> accordingly. More Info: (2)

添加所需范围时,请查看API 定义.例如,如果您想生成一个访问令牌以在 GET https://:/api/server/v1/tenants 请求的授权中使用,您应该通过 internal_list_tenants 作为范围.您也可以传递由 scapes 分隔的多个作用域.

When adding the required scopes, look at the scopes required section of each endpoint in API definition. For example If you want to generate an access token to use in GET https://<HOST>:<PORT>/api/server/v1/tenants request's authorization, you should pass internal_list_tenants as a scope. Also you can pass multiple scopes separated by scapes.

  1. 使用检索到的访问令牌授权 REST 端点.如果您在未传递所需范围的情况下生成了令牌,您将收到来自 REST API 调用的 403 Forbidden 响应.更多信息 (3)
  1. Use the retrieved access token to authorize the REST endpoint. If you generated the token without passing the required scopes, you will get 403 Forbidden response from the REST API call. More info (3)

这篇关于执行 wso2is REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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