簡體   English   中英

使用 WSO2IS 中的用戶名和密碼授權服務提供者令牌?

[英]Authorize the Service Provider token with using the username and password in WSO2IS?

大家好,創建成功后授權服務商的時候卡住了。 讓我向您解釋一下,我使用此 API 集創建了服務提供者( https://is.docs.wso2.com/en/latest/apis/application-rest-api/#/Applications/createApplication

我向它添加了用戶。 成功創建服務提供者后,我將獲得 clientId 和密鑰。 之后,我使用該 clientId 和密鑰來獲取訪問和刷新令牌(到目前為止很酷),為了獲取訪問令牌和刷新令牌,我使用這個 curl 請求。

curl -u <client_id>:<secret_id> -k -d "grant_type=password&username=admin@easybazaar.co&password=admin" -H "Content-Type:application/x-www-form-urlencoded" https://<ip>/oauth2/token

一旦我有了訪問令牌,我就將其提供給用戶(前端團隊)以將其存儲在他/她的存儲 session 中。 現在用戶想要訪問一些資源,例如活動列表,他/她還在該請求的 header 中發送該訪問令牌作為不記名令牌,例如;

curl -k http://localhost:8080/activities -H "Authorization: Bearer <access-token>

現在我想驗證該訪問令牌並檢查其驗證和到期。 我探索了需要用戶名和密碼的內省 API,但客戶端並未在每個請求中提供它。

curl -k -u <USERNAME>@<TENAND_DOMAIN>:<PASSWORD> -H 'Content-Type: application/x-www-form-urlencoded' -X POST --data 'token=<ACCESS_TOKEN>' https://<IS_HOST>:<IS_PORT>/t/<TENANT_DOMAIN>/oauth2/introspect

那么,我怎樣才能實現它,是否有任何 API 集可用於此任務? 任何幫助將不勝感激。

我沒有從用戶那里獲取任何用戶名和密碼來應用自省 API,我是否應該在創建服務提供程序時在令牌中使用 email,所以通過使用這個 email,我將在我的數據庫中查看用戶並獲取憑據然后點擊自省 API。

似乎這在舊版本的 IS 中不存在,並且是從 IS 6.0.0 開始引入的。 發現這個遷移問題

如果您無法遷移到 IS 6.0.0,我建議您創建一個僅具有自省令牌權限的用戶(該用戶將僅用於令牌自省)並使用該用戶名和密碼來驗證內省請求。

編輯:對於 IS 6.0.0,您可以使用以下基本配置。

[[resource.access_control]]
context="(.*)/oauth2/introspect(.*)"
secure = "true"
http_method = "all"
cross_tenant = true
allowed_auth_handlers="BasicClientAuthentication"

或者您可以使用如下高級配置。

[[resource.access_control]]
context="(.*)/oauth2/introspect(.*)"
secure = "true"
http_method = "all"
cross_tenant = true
cross_access_allowed_tenants="carbon.super"
allowed_auth_handlers="BasicClientAuthentication"
permissions=["/permission/admin/manage/identity/applicationmgt/view"]
scopes=["internal_application_mgt_view"]

暫無
暫無

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

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