Skip to content

ClaimsPrincipal on ASP.NET Core v8.0.100-rc.2.23502.2 Doesn't Contain All Claims From The OpenIdConnect Token #51538

@smjxpro

Description

@smjxpro

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have an existing Blazor project which was in .NET 8 RC1. After upgrading to .NET 8 RC2, authentication and authorization using OIDC (Keycloak) isn't working as expected.

For example, on my IClaimsTransformation implementation I could access the realm_access property like this:
var realmAccessValue = principal.FindFirst("realm_access")?.Value;

Also, the exp, email_verified except for a few is missing on the ClaimsPrincipal object.

Expected Behavior

The ClaimsPrincipal object should contain all the token claims.

Steps To Reproduce

  1. Create a new Blazor Web App project without interactivity
  2. Add Microsoft.AspNetCore.Authentication.OpenIdConnect 8.0.0-rc.2.23480.2
  3. Configure to use Keycloak or any other OIDC provider
  4. Create and register an IClaimsTransformation implementation and register it in DI
  5. On the TransformAsync method try to access some values which is on the token (jwt.io). For example for Keycloak: var realmAccessValue = principal.FindFirst("realm_access")?.Value;
  6. The value is null

Exceptions (if any)

No response

.NET Version

8.0.100-rc.2.23502.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Status: No Recent Activityarea-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions