[英]Understanding Microsoft Azure AD On-Behalf-Of (OBO) flow
FE->(token_a)中間人->(token_b)DownstreamServiceA
我的理解是,對於Middleman
來進行API調用來DownstreamServiceA
,它需要換token_b
使用token_a
。 我試圖在郵遞員中模擬這種行為。 但我無法換取token_b
使用token_a
。 我收到以下錯誤
AADSTS65001: The user or administrator has not consented to use the application with ID '{my-middleman-clientid}'
在Azure門戶上,我已配置FE API權限以訪問DownstreamServiceA
和Middleman
的公開API范圍。 當時也代表我的組織用戶獲得了管理員的同意。
獲取token_a
POST to https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
grant_type:password
client_secret: foobar
client_id: my-fe-clientid
username: awesome
password: bar
scope: api://{MiddlemanId}/Middleman.All
交換token_b
POST to https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
grant_type: urn:ietf:params:oauth:grant-type:jwt-bearer
client_id: my-middleman-clientid
client_secret: foobar
scope: api://{DownstreamServiceAId}/ServiceA.all
assertion: {token_a}
requested_token_use: on_behalf_of
我可以知道我做錯了什么嗎? 我的理解是,我的FE需要預先請求和授予DownStreamServiceA
范圍的權限,這是我在Azure門戶上使用管理員授予完成的。
看來您已授予FE對Middleman的訪問權限,並且已授予FE對DownstreamServiceA的訪問權限,但可能未授予Middleman對DownstreamServiceA的訪問權限。
有多種方法可以執行此操作,如授予中間層應用程序許可中所述 :
knownClientApplications
),並通過在FE請求scope=openid api://{MiddlemanId}/.default
觸發“組合”同意。 同意提示將包括FE和Middleman都需要的所有權限,並且將根據需要為FE對Middleman和Middleman對DownstreamServiceA正確設置記錄的授予。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.