We have an AspNet Core web site and related web api that are secured against Azure Active Directory. A manager logs into the website to manage staff that work in branches.
We currently define what branches a manager manages using "App Roles" that are defined in the application's registration manifest.
In the AspNet WebSite those roles are the returned in the ClaimsPrincipal.Claims collection under the ClaimTypes.Role
, "http://schemas.microsoft.com/ws/2008/06/identity/claims/role".
However if we implement an AspNet web api that is called from that same AspNet WebSite the claim is not available in the api. For example
GET https://ourdomain.com/api/v1/managers/-/staff
In the AspNet web api I can inspect the claims via the HttpContext but the Roles claim type is not present.
How do I get the Roles claim in the api? I want to get at the individual values of the Role claims as that has the ID of the various branches.
The WebApi has its Auth defined usign Microsoft.Identity.Web
public void ConfigureServices(IServiceCollection services)
{
services.AddMicrosoftIdentityWebApiAuthentication(Configuration);
services.AddControllers();
}