在使用Azure註冊我開發的API後,我有一個關於SCP聲明的問題。我跟着各種教程和示例應用程序。一切都正確驗證,我能夠調用從受信任的子系統主要使用本教程API方法:https://github.com/AzureADSamples/WebApp-WebAPI-OAuth2-AppIdentity-DotNetAzure API管理 - 範圍聲明NULL
說我遇到的問題是,當我嘗試驗證SCP要求:
Claim scopeClaim = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/scope");
scopeClaim值始終爲空。我確實看到ClaimPrincipal.Current對象內的索賠,但看不到範圍。我的理解是,如果我下載清單並上傳包含應用程序權限,則它將在API中可用,以驗證調用應用程序是否具有正確的範圍。下面是我的應用程序清單(僅appPermissions):
"appPermissions": [
{
"claimValue": "access.fullaccess",
"description": "Allow the application full access to the service on behalf of the signed-in user",
"directAccessGrantTypes": [],
"displayName": "Have full access to the service",
"impersonationAccessGrantTypes": [
{
"impersonated": "User",
"impersonator": "Application"
}
],
"isDisabled": false,
"origin": "Application",
"permissionId": "52966341-1bb5-4e9f-b4f6-46aad4d03b33",
"resourceScopeType": "Personal",
"userConsentDescription": "Allow the application full access to the service on your behalf",
"userConsentDisplayName": "Have full access to the service"
}
]
預先感謝您......保羅
所以在進一步玩弄併爲API創建多個appPermissions,並允許客戶端Web應用程序選擇多JWT返回的「範圍」不包含任何範圍索賠。有什麼我失蹤或沒有正確地做?任何幫助將非常感激。
這是可能的邏輯應用程序是API消費者?目前我們閱讀的所有文檔都沒有幫助。 – M0rty 2017-04-05 00:01:43