Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How do I view my role as a claim when using Azure Active Directory Authentication with ASP.NET core

$
0
0

My ASP.NET Core on .NET Core 2.0 app is authenticating with Azure Active directory with the following code:

///
/// Azure AD Configuration
///
var clientId = "YYYYY";
var tenantId = "XXXXX";

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
AuthenticationScheme = "oidc",
DisplayName = "AzureAD",
SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
ClientId = clientId,
Authority = $"https://login.microsoftonline.com/{tenantId}",
ResponseType = OpenIdConnectResponseType.IdToken,
StateDataFormat = dataFormat
});

I can login successfully. When I iterate my Users.Claims object I get the following claim name:

nbf
exp
iss
aud
nonce
iat
sid
sub
auth_time
idp
family_name
given_name
name
amr

I have zero User.Identities.

My user is in the role Observers whic is defines as follows in the manufest:

{
"allowedMemberTypes": [
"User"
],
"displayName": "Observer",
"id": "fcac0bdb-e45d-4cfc-9733-fbea156da358",
"isEnabled": true,
"description": "Observers only have the ability to view tasks and their statuses.",
"value": "Observer"
}

How do I view that role in the Microsoft.AspNetCore.Authorization.Infrastructure.User object?


Viewing all articles
Browse latest Browse all 9386

Trending Articles