2016-09-19 52 views
0

嘗試新的WSO2 API Manager 2.0.0目前爲止的基本設置看起來不錯,但是當我試圖授權作用域的特定資源時(如in the article所述將作用域分配給資源),瀏覽器控制檯聲稱:WSO2AM 2.0.0作用域定義 - 錯誤還是錯誤?

jquery.validate.min.js:4 Uncaught TypeError: Cannot read property 'settings' of undefined 

並且範圍不能被選擇。我做錯了還是錯誤?可以使用swagger文件定義和分配範圍嗎?

謝謝您提前

g。

+0

您是否在添加資源前使用「添加範圍」按鈕正確添加範圍..? – Malintha

回答

0

部分回答問題:

1.能的範圍限定和使用招搖文件進行分配?

是的。您需要首先在「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 
+1

是的,當使用swagger文件分配角色時,它可以工作(儘管 - 不能通過多個apis使用相同的作用域名稱)。顯然,用戶界面尚未打磨。謝謝。 – gusto2