我有一个node / express应用程序,它在IBM Cloud上使用IBM ApiConnect公开api。
==更新START ==
我没有直接从目录服务使用IBM ApiConnect,但我使用了选项“Api Management”并更新了API定义
==更新结束==
我需要定义两种安全API:打开Api 和安全Api 。 第一个应该打开,第二个需要Client Id和Client Secret。
我无法正确定义此要求,有人可以帮助我吗?
==更新START ==
/ callback / sign应打开
/ services / products应安全
==更新结束==
这是我的yaml in section:
Api等级的安全定义
paths:
/callback/sign:
get:
responses:
'200':
description: 200 OK
security:
- {}
post:
responses:
'200':
description: 200 OK
parameters:
- name: body
required: false
in: body
schema:
type: object
security:
- {}
/services/products:
get:
responses:
'200':
description: 200 OK
最后是路径定义:
options.addPreference("security.sandbox.content.level", 5);
答案 0 :(得分:1)
我建议使用可视化编辑器。根据您的示例,这是您的yaml文件的外观:
paths:
/callback/sign:
get:
responses:
'200':
description: 200 OK
post:
responses:
'200':
description: 200 OK
parameters:
- name: body
required: false
in: body
schema:
type: object
/services/products:
get:
responses:
'200':
description: 200 OK
security:
- client_id: []
client_secret: []
答案 1 :(得分:0)
如果你想设置一个安全默认值,然后为一个或多个路径/操作覆盖它,"没有安全性" /"打开"应编码为
security: []
而不是
security:
- {}