Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Created September 15, 2014 11:04
Show Gist options
  • Save tugberkugurlu/70a42b426b68c760673d to your computer and use it in GitHub Desktop.
Save tugberkugurlu/70a42b426b68c760673d to your computer and use it in GitHub Desktop.
public static class ClaimsIdentityExtensions
{
public static string GetUserEmail(this ClaimsIdentity identity)
{
Claim emailClaim = identity.Claims.FirstOrDefault(claim => claim.Type == ClaimTypes.Email);
return emailClaim != null
? emailClaim.Value
: null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment