Open Closed

Can't access custom claim types in ICurrentUser or ClaimsPrincipal #359


User avatar
0
bhyatz created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.0.4
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): yes / no
  • Exception message and stack trace: None
  • Steps to reproduce the issue:

I can't see the custom claim in the current user or pricipal

I have added a custom claim type "testClaimType" using the frontend

I have added the a claim value for this claim to the Admin user

During Login The AbpUserClaimsPrincipalFactory loads the custom claims correctly. As you can see there is claim of testClaimType with value 12.

However the claim type does not show in the current user claims or the ClaimsPrincipal .

How do you get the claims for the custom claim types for the current user?

Is it possible to add the custom claim types to the current users claims?


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to create a corresponding Identity resources.

  • User Avatar
    0
    bhyatz created

    Hi

    Thanks. I got it working.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09