简体   繁体   中英

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

After that I calling GET API using sayhello. It's everything fine, but I want based on token and UserId/Password of AD user get user role. 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 .

Here is an example covered of how to verify and decode Azure Active Directory Token, refer this article .

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.

Please refer this thread which contains code to decode a bearer token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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