繁体   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

我正在关注链接以进行身份验证和授权。

我能够基于https://login.microsoftonline.com/{tenantID}/oauth2/token成功创建令牌

之后,我使用 sayhello 调用 GET API。 一切都很好,但我想根据 AD 用户的令牌和 UserId/Password 获取用户角色。 我搜索了很多,但没有得到任何具体的解决方案。

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

这是一个关于如何验证和解码 Azure Active Directory 令牌的示例,请参阅本文

如果要使用 azure 活动目录手动解码持有者令牌,可以使用JwtBearerAddAzureADBearer中间件来验证访问令牌。

请参考这个线程,其中包含解码承载令牌的代码。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM