1

I am building an asp.net core web API project, with Angular client for front-end. We are using azure b2c as our IDP server, (for registration, authentication and related topics). So far the experience is great.

The issue we are having right now, is that we are trying to add 'admin' role to some of our users, who will be allowed to reach some endpoints of our web API, and do some operations that normal users won't be allowed to. Since we are using asp.net5 web API for our back-end, in a normal environment, this would be done through [Authorize (Role = "Admin")] attribute, however in Azure b2c it seems not a straight forward thing to do.

Right now, we need 2 types of user roles: User role and Admin role.

Anyone knows how to add user roles in a azure b2c app, and then protect the back-end API endpoints for those roles?

Thank you!

Genc Hani
  • 85
  • 1
  • 11

1 Answers1

1

There is no out-of-the-box support for RBAC / Roles in Azure AD B2C. However there are a lot of samples in the official GitHub repository. For example the "Implementing Relying Party Role Based Access Control" or "User consent for API Scopes".

These are the ways to implement RBAC using Azure AD B2C.

Raghavendra beldona
  • 1,937
  • 1
  • 4
  • 9