久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

ASP Core Azure Active Directory 登錄使用角色

ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
本文介紹了ASP Core Azure Active Directory 登錄使用角色的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我創建了一個 Azure Active Directory 應用程序,并且我想使用基于角色的安全性.我按照以下教程進行操作:

I created an Azure Active Directory Application and i want to use role based security. I followed the tutorial on: https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/

The login works, I added roles to the application manifest and assigned the role Approver to my own account. Now i want to use these roles.

After login the following works in the controller:

[Authorize]

But when adding the role the user is not authorized:

[Authorize(Roles="Approver")]

Also the following returns false:

User.IsInRole("Approver");

It seems the roles are not retreived, any suggestions on how to add the role functionality to this demo project?

解決方案

This code sample works for me after assign roles to account . Please debug application in this line: User.IsInRole("Approver"); , check whether {http://schemas.microsoft.com/ws/2008/06/identity/claims/role: Approver}exists in user claims . And make sure you add roles which allowedMemberTypes is user , for example :

{
      "allowedMemberTypes": [
        "User"
      ],
      "displayName": "Approver",
      "id": "fc803414-3c61-4ebc-a5e5-cd1675c14bbb",
      "isEnabled": true,
      "description": "Approvers have the ability to change the status of tasks.",
      "value": "Approver"
    },

And you have assign the user role in Enterprise applications-->All applications--> find your app-->Users and groups--> add/edit a user and assign roles :

這篇關于ASP Core Azure Active Directory 登錄使用角色的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應用程序密碼從 oauth2/token 獲取訪問令牌)
主站蜘蛛池模板: 精国产品一区二区三区四季综 | 国产精品久久久久久久久久久久久 | 国产精品永久 | 国产精品视频一区二区三区四蜜臂 | 亚洲一区二区在线播放 | 在线婷婷| 国产精品不卡 | 黄网站涩免费蜜桃网站 | 亚洲精品国产精品国自产在线 | 国产xxxx搡xxxxx搡麻豆 | 国产精品视频中文字幕 | 羞羞视频在线观看 | 国产精品久久久久久久久久三级 | 91原创视频在线观看 | 久久久国产一区二区三区 | 成人国产免费观看 | 亚洲第一视频网站 | 国产精品a免费一区久久电影 | 国产美女视频黄a视频免费 国产精品福利视频 | 日韩视频免费在线 | 天天干天天干 | 中文字幕在线一区二区三区 | 蜜桃视频在线观看免费视频网站www | 亚洲欧美少妇 | 中文字幕一区在线 | 日韩中文字幕一区二区 | 夜夜操天天操 | 91 中文字幕| 成人免费观看网站 | 免费av直接看 | 亚洲成人三区 | 羞羞视频网 | 国产精品1区 | 国产精品国产三级国产播12软件 | 国产伦精品一区二区三区照片91 | 成人国产一区二区三区精品麻豆 | 精品视频一区二区 | 欧美一区二区三区久久精品视 | 中文字幕男人的天堂 | 久久精品国产一区 | 精品一区二区久久 |