繁体   English   中英

如何使用 wso2 api manager rest apis(非发布者门户网站)设置端点安全性

[英]How to set up an endpoint security using wso2 api manager rest apis (NOT Publisher web portal)

我正在使用 wso2 apim 4.0.0。 我想创建和发布一个 api。 根据文档,除了发布者门户网站外,还可以使用 rest api 来做到这一点。 我认为,要完成这项任务,应该完成以下工作:

  1. 使用 https://{apimhost}/api/am/publisher/v2/apis 创建 api
  2. 使用 https://{apimhost}/api/am/publisher/v2/apis/{apiId}/revisions 为 api 创建修订
  3. 使用 https://{apimhost}/api/am/publisher/v2/apis/{apiId}/deploy-revision 部署修订
  4. 使用 https://{apimhost}/api/am/publisher/v2/apis/change-lifecycle 发布 api

可能存在端点受到保护的情况。 假设它受到基本身份验证的保护。 可以使用如下所示的端点安全配置在发布者门户网站上轻松进行设置:

端点安全配置

问题是如何使用发布者(或其他)rest api 设置安全参数端点? 是否有任何 api 来指定端点的安全参数?

添加 Endpoint Security 配置可以通过 WSO2 API Manager Publisher REST API 通过将endpoint_security块引入 API 创建请求正文来实现,如下定义

...
"endpointConfig": {
    "endpoint_type": "http",
    "sandbox_endpoints": {
        "url": "http://backendurl"
    },
    "production_endpoints": {
        "url": "http://backendurl"
    },
    "endpoint_security": {
        "sandbox": {
            "password": null,
            "tokenUrl": null,
            "clientId": null,
            "clientSecret": null,
            "customParameters": {},
            "type": null,
            "grantType": null,
            "enabled": false,
            "username": null
        },
        "production": {
            "password": null,
            "tokenUrl": "http://tokenendpoint",
            "clientId": "clientID",
            "clientSecret": "clientSecret",
            "customParameters": {},
            "type": "OAUTH",
            "grantType": "CLIENT_CREDENTIALS",
            "enabled": true,
            "username": null
        }
    }
},
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM