Identity & Claims: Multiple Values for single ClaimType?
I haven't been able to find any good resources for this, though I'm sure I'm not using the correct search terms.
My MVC application uses Identity with Claims. I use the claims to populate information like the user's name and other user specific properties. However, now I have a need to assign a claim to a user that has multiple values, and I'm not entirely sure how that works in Identity.
For example, my app has three companies: A, B, and C. User1 can access Company A and B, and User2 can access Companies A and C. I initially tried storing this information as multiple rows with the same "ClaimType" in the AspNetUserClaims table (screenshot). However, when creating the identity, it's only bringing back one company (screenshot). I thought - ok, maybe I'm doing this wrong. But for shits and giggles, I added MORE rows (screenshot). And now it's coming back with SOME of them, but not all of them (screenshot).
Clearly, I'm not doing something correctly. Can someone please help guide me? The goal is to allow someone to switch between "companies" so that all data they see is from that currently selected company across all application pages, until they choose to switch to another company.
I had read about "multitenancy" but that doesn't seem to be the correct application here.
0 comments:
Post a Comment