Good morning,
I need to be able to support users having multiple roles within my application, For example, a user can be Admin and Supervisor, but when I add the claims for this separately, they get merged together into one claims which cause the User.IsInRole to fail.
Here is some sample code that I put together from my IProfileService:
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
var newClaims = new List<Claim>();
newClaims.Add(new Claim("User", "James"));
newClaims.Add(new Claim("role", "Admin"));
newClaims.Add(new Claim("role", "Supervisor"));
newClaims.Add(new Claim("DummyClaim", "Value 1"));
newClaims.Add(new Claim("DummyClaim", "Value 2"));
context.IssuedClaims = newClaims;
}
When I parse the User.Claims collection, this is what I get:
User Claims:
Count: 5
sid
c64e00090cf702090f65ed3048a50534
sub
17d1533c-675a-40cb-ab03-e3c25ea0ec95
User
James
role
[ "Admin", "Supervisor" ]
DummyClaim
[ "Value 1", "Value 2" ]
At first I thought it was an issue with the "role" claim type, but as the last example shows, its not.
Is there some property that I need to set to get it to not merge the claim together? I am assuming it has something to do to with the Claims Transformation, but I can't figure out how to get it to not to do the merging.
Thanks for you help,
David
Good morning,
I need to be able to support users having multiple roles within my application, For example, a user can be Admin and Supervisor, but when I add the claims for this separately, they get merged together into one claims which cause the User.IsInRole to fail.
Here is some sample code that I put together from my IProfileService:
When I parse the User.Claims collection, this is what I get:
At first I thought it was an issue with the "role" claim type, but as the last example shows, its not.
Is there some property that I need to set to get it to not merge the claim together? I am assuming it has something to do to with the Claims Transformation, but I can't figure out how to get it to not to do the merging.
Thanks for you help,
David