Authorization with Roles #3223
-
|
I previously asked this on Stack Overflow. We have an ASP.NET Core MVC application and want to migrate from on-premise Active Directory to Microsoft Entra ID. Authentication works without any issues, but authorization does not. Currently, we use I replaced with But the user gets redirected to After setting I was under the impression that this would automatically work with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I discovered these Examples which helped a lot. We solved our issue by using App Roles and combining them with security groups in Microsoft Entra. Then, in our builder.Services
.AddAuthentication(IISDefaults.AuthenticationScheme)with JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
builder.Services
.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration);
builder.Services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
options.TokenValidationParameters.RoleClaimType = "roles";
}); |
Beta Was this translation helpful? Give feedback.
I discovered these Examples which helped a lot.
We solved our issue by using App Roles and combining them with security groups in Microsoft Entra.
Then, in our
Program.cswe replacedwith