The following forum(s) have migrated to Microsoft Q&A (Preview): Azure Active Directory!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
WebApi token based Authentication and Authorization .net core 2.1 RRS feed

  • Question

  • I need to build .net core web API, which should be Authenticated and Authorize based on token sent in headers using .net core 2.1.

    I am able to do Authentication using Azure AD app (client ID, Client secret, tenant id, etc.) but I want to do Authorization, I have created 3 groups in Azure AD and assign groups to the users as well.

    1) How should I achieve this, as it is an urgent requirement, the consumer will be another website, that will be sent a request with a token to web API.

    2) As per my understanding token should be generated using user credentials instead Azure AD app. I am able to do to Authorization in the MVC app, but not in WebApi.

    3) For Authorization should I or can I maintain role mapping in SQL table?

    Any help is much appreciated.

    Tuesday, December 3, 2019 12:39 PM

All replies

  • I think for your scenario you may want to look at Basic Authentication.

    Are you following a particular guide or sample?


    Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!

    Wednesday, December 4, 2019 7:50 AM
  • You can define roles using RBAC in the Azure portal and use built-in or custom roles. This sample should be helpful to you. 

    This overview is also useful.

    Let me know if this is what you are looking for or if you need further help. I would suggest also asking in Microsoft Q&A as we have migrated there. 


    Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!

    Friday, December 6, 2019 4:46 PM