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

ASP Core Azure Active Directory 登錄使用角色

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

問題描述

限時送ChatGPT賬號..

我創(chuàng)建了一個 Azure Active Directory 應(yīng)用程序,并且我想使用基于角色的安全性.我按照以下教程進(jìn)行操作:

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 :

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

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

相關(guān)文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進(jìn)行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權(quán)不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護(hù)進(jìn)程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發(fā)技
.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(異步調(diào)用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應(yīng)用程序密碼從 oauth2/token 獲取訪問令牌)
主站蜘蛛池模板: 国产精品不卡视频 | 亚洲精品久久久久久久久久久 | 国产免费a | 福利视频免费 | 国产一区二区网站 | 欧美日韩在线观看视频 | 日韩欧美小视频 | 日韩网站免费观看 | 日本精品视频在线 | 午夜视频网 | 天天干夜夜 | 欧美一区二区三区成人 | 国产精品一区二区三区不卡 | 欧美在线一区二区 | 亚洲一区二区久久 | 17c国产精品一区二区 | 四虎在线免费观看视频 | 日韩精品一级 | 国产黄在线 | 九九热在线观看视频 | 精品国产乱码久久久久久蜜柚 | 精品一区二区三区在线观看 | 久久都是精品 | 他揉捏她两乳不停呻吟动态图 | 久久香蕉网 | 中文字幕亚洲综合 | 欧美精品一区在线观看 | 日韩一区二区三区视频 | 求av网站| av福利在线观看 | 中文字幕av网站 | 日本中文字幕网站 | 亚洲综合精品 | 性做久久久 | 免费啪视频 | 欧美日韩大片 | 逼逼操 | 色偷偷噜噜噜亚洲男人 | 国产精品成人国产乱一区 | 中文字幕在线网站 | 能看毛片的网站 |