WSO2AM 2.0.0 范围定义 - 错误或错误?
WSO2AM 2.0.0 scope definition - bug or mistake?
正在试用新的 WSO2 API Manager 2.0.0 到目前为止,基本设置看起来还不错,但是当我尝试为范围授权特定资源时(如所述为资源分配范围 in the article),浏览器控制台声明:
jquery.validate.min.js:4 Uncaught TypeError: Cannot read property 'settings' of undefined
并且无法选择范围。我做错了什么还是错误?可以使用 swagger 文件定义和分配范围吗?
提前致谢
g.
部分回答问题:
1.可以使用 swagger 文件定义和分配范围吗?
是的。您需要首先在 "x-wso2-security" 下全局定义它们,然后使用 "x-scope" 元素将它们分配给资源。
参见下面的示例。
swagger: '2.0'
paths:
/*:
get:
responses:
'200':
description: ''
x-auth-type: Application & Application User
x-throttling-tier: Unlimited
x-scope: api1_read
post:
responses:
'200':
description: ''
parameters:
- name: Payload
description: Request Body
required: false
in: body
schema:
type: object
properties:
payload:
type: string
x-auth-type: Application & Application User
x-throttling-tier: Unlimited
info:
title: api1
version: '1.2'
x-wso2-security:
apim:
x-wso2-scopes:
- name: read api name
description: ''
key: api1_read
roles: admin
正在试用新的 WSO2 API Manager 2.0.0 到目前为止,基本设置看起来还不错,但是当我尝试为范围授权特定资源时(如所述为资源分配范围 in the article),浏览器控制台声明:
jquery.validate.min.js:4 Uncaught TypeError: Cannot read property 'settings' of undefined
并且无法选择范围。我做错了什么还是错误?可以使用 swagger 文件定义和分配范围吗?
提前致谢
g.
部分回答问题:
1.可以使用 swagger 文件定义和分配范围吗?
是的。您需要首先在 "x-wso2-security" 下全局定义它们,然后使用 "x-scope" 元素将它们分配给资源。
参见下面的示例。
swagger: '2.0'
paths:
/*:
get:
responses:
'200':
description: ''
x-auth-type: Application & Application User
x-throttling-tier: Unlimited
x-scope: api1_read
post:
responses:
'200':
description: ''
parameters:
- name: Payload
description: Request Body
required: false
in: body
schema:
type: object
properties:
payload:
type: string
x-auth-type: Application & Application User
x-throttling-tier: Unlimited
info:
title: api1
version: '1.2'
x-wso2-security:
apim:
x-wso2-scopes:
- name: read api name
description: ''
key: api1_read
roles: admin