Friday, August 16, 2013

WIF: IsAuthenticated is false on a ClaimsIdentity

Let’s end this week with a last WIF related post. When you create a new ClaimsIdentity in your code and you check the IsAuthenticated property it will return false by default. This is a breaking change compared to the previous identity types. The idea is that in a claims model your users can be anonymous although they have specified some claims(e.g. an age claim).

If you want your IsAuthenticated property to return true, you need to set an authentication type when instantiating the ClaimsIdentity object:

No comments: