Question

I'm playing around with claimbaised authorization in .net 4.5 . This works pretty fine. But I got a hopefully small problem.

I thought that setting the name claim type should result in a identity name

I checked that ident.NameClaimType has the same value as ClaimTypes.Name Both are http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name

I set the new claim. Which i can see is part of the identity claims. but Identity.Name is still empty.

what am I doing wrong?

  ClaimsIdentity ident = (ClaimsIdentity)incomingPrincipal.Identity;

  ident.AddClaim(new Claim(ClaimTypes.Name, resourceName));
Was it helpful?

Solution

I had the same issue when my claims identity had not AuthenticationType set. Once I have passed in an AuthenticationType in the ClaimsIdentity constructor it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top