久久久久久久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 獲取訪問令牌)
主站蜘蛛池模板: 日韩欧美中文 | 中文字幕一区二区三区精彩视频 | 国产精品亚洲二区 | 美女黄色在线观看 | 男插女下体视频 | 午夜免费福利片 | 日本啊v在线| 中文字幕在线观看视频一区 | 精品国产一区二区三区久久久久久 | 亚洲一区免费 | 免费观看av网站 | 国产精品中文字幕在线 | 中文字幕成人在线 | 天天躁日日躁xxxxaaaa | 亚洲 欧美 激情 另类 校园 | 国产伊人精品 | 国产一区二区欧美 | 福利视频一区二区 | 久久伊人久久 | 韩国理论电影在线 | 日本精品一区二区三区在线观看 | av在线免费观看网站 | 可以免费观看的av片 | 亚洲成人三级 | 中文字幕国产第一页 | 国产午夜精品一区二区三区四区 | 欧美日韩在线观看一区二区三区 | 天天插天天狠天天透 | 成人在线视频网 | 国产精品国产精品国产专区不片 | 亚洲成人中文字幕 | 黄色片在线网站 | 一区二区三区视频在线观看 | 在线免费观看毛片 | 在线免费观看黄色 | 天堂av免费观看 | 在线日韩福利 | 久久尤物免费一区二区三区 | 成人精品免费 | 亚洲国产一区二区三区 | 日韩精品免费播放 |