简体   繁体   English

Azure easy auth get user role based on AD user Id ASP.net core app WebAPI

[英]Azure easy auth get user role based on AD user Id ASP.net core app WebAPI

I'm following link to make authentication and authorization.我正在关注链接以进行身份验证和授权。

I able to create successfully token based on https://login.microsoftonline.com/{tenantID}/oauth2/token我能够基于https://login.microsoftonline.com/{tenantID}/oauth2/token成功创建令牌

After that I calling GET API using sayhello.之后,我使用 sayhello 调用 GET API。 It's everything fine, but I want based on token and UserId/Password of AD user get user role.一切都很好,但我想根据 AD 用户的令牌和 UserId/Password 获取用户角色。 I search a lot but not getting any concrete solution.我搜索了很多,但没有得到任何具体的解决方案。

To decode the Azure Active Directory JWT token using the tool, you can use this online decode tool JSON Web Tokens - jwt.io . To decode the Azure Active Directory JWT token using the tool, you can use this online decode tool JSON Web Tokens - jwt.io .

Here is an example covered of how to verify and decode Azure Active Directory Token, refer this article .这是一个关于如何验证和解码 Azure Active Directory 令牌的示例,请参阅本文

If you want to manually decode a bearer token using azure active directory, you can use JwtBearer or AddAzureADBearer middleware to validate the access token.如果要使用 azure 活动目录手动解码持有者令牌,可以使用JwtBearerAddAzureADBearer中间件来验证访问令牌。

Please refer this thread which contains code to decode a bearer token.请参考这个线程,其中包含解码承载令牌的代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Asp.net重定向到基于页面的Azure AD用户 - Asp.net redirect to page based Azure AD user 在 Azure 中部署 ASP.net 核心应用程序时,Azure AD 的 400 id 令牌无效 - 400 invalid id token for Azure AD when ASP.net core app is deployed in Azure 保持仅使用Azure ASP.NET Core WebAPI的应用程序 - Keep azure asp.net core webapi-only app on ASP.NET MVC Core 3.1 中的自定义用户数据与 Azure AD 身份验证? - Custom User data in ASP.NET MVC Core 3.1 with Azure AD Authentication? 如何显示受限于 Azure AD 企业应用程序级别 + ASP.Net Core 的用户定义消息 - How to display user defined message who are restricted at Azure AD Enterprise Application level + ASP.Net Core 如何使用 Azure AD 身份验证为 Asp.net WebApi 实施 Twitter 数字身份验证 - How to implement Twitter Digits Authentication with Azure AD Auth for Asp.net WebApi 使用来自ASP.NET应用程序的AD密码身份验证连接到Azure SQL失败,并显示“需要用户界面才能继续” - Connecting to Azure SQL with AD Password Authentication from ASP.NET app fails with “Need user interface to continue” 阅读ASP.net中的Azure AD登录用户详细信息 - Read Azure AD login user details in ASP.net 通过Azure AD ADAL的ASP.NET MVC用户身份验证 - ASP.NET MVC User Authentication through Azure AD ADAL Azure 应用服务授权/简易身份验证冲突 ASP.NET Forms 身份验证 - Azure App Service authorization/easy auth is conflicting ASP.NET Forms auth
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM