簡體   English   中英

WSO2 API Manager 2.0.0 - LDAP和發布程序API令牌問題

[英]WSO2 API Manager 2.0.0 - LDAP & Publisher API Token Issue

我已將WSO2 API Manager 2.0.0配置為將內部用戶存儲作為主用戶,將LDAP作為輔助用戶存儲。 我可以使用LDAP用戶登錄Carbon,Publisher和Store UI。 我的目標是允許LDAP用戶使用Publisher REST API,我遵循的步驟如下;

  1. 創建服務提供商

     curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "clientName": "rest_api_publisher", "tokenScope": "Production", "owner": "admin", "grantType": "password refresh_token", "saasApp": true }' "http://localhost:9763/client-registration/v0.10/register" 

    響應

      { "jsonString": "{\\"username\\":\\"admin\\",\\"redirect_uris\\":null,\\"client_name\\":\\"admin_rest_api_publisher\\",\\"grant_types\\":\\"urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm refresh_token client_credentials password\\"}", "appOwner": null, "clientName": null, "callBackURL": null, "isSaasApplication": true, "clientId": "N2GP9igHPkEcotmyE6ccyPLBeh0a", "clientSecret": "qHO0ZFsaGDGGEaHO_4PXgKOXVWYa" } 
  2. 獲取管理員用戶的訪問令牌

     curl -X POST -H "Authorization: Basic TjJHUDlpZ0hQa0Vjb3RteUU2Y2N5UExCZWgwYTpxSE8wWkZzYUdER0dFYUhPXzRQWGdLT1hWV1lh" -H "Cache-Control: no-cache" "https://localhost:8243/token?grant_type=password&username=admin&password=admin&scope=apim:api_view%20apim:api_publish%20apim:api_create" 

    響應

      { "scope": "apim:api_create apim:api_publish apim:api_view", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "787b34a2-55eb-3baa-b83a-7041959781ce", "access_token": "2b7ad48c-67d8-3ebc-acd8-1d02aca85fdd" } 

正如您在本案中所看到的,范圍包含我請求的所有范圍。 有了這個令牌,我可以查詢並添加新API並發布它們。 我遇到的問題是,當我對LDAP用戶執行相同操作時,范圍是默認的。

(PS:我的二級域名是mzaferyahsi.com)

  1. 獲取ldap用戶的訪問令牌

     curl -X POST -H "Authorization: Basic TjJHUDlpZ0hQa0Vjb3RteUU2Y2N5UExCZWgwYTpxSE8wWkZzYUdER0dFYUhPXzRQWGdLT1hWV1lh" -H "Cache-Control: no-cache" "https://localhost:8243/token?grant_type=password&username=mzaferyahsi.com/<<username>>&password=<<password>>&scope=apim:api_view%20apim:api_publish%20apim:api_create" 

    響應

      { "scope": "default", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "2a519b92-2fe8-3b85-8da8-6ea8b2eceb6e", "access_token": "874aac4f-c441-3927-bd1b-cce859e58988" } 

有人遇到過這個問題嗎? 任何解決方案贊賞

您必須在tenant-conf.json file設置所需的角色范圍映射。 用戶還應該具有所需的角色。 該文件在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM