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
image.png

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

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

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

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.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 11, 2025, 10:10