Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Created September 15, 2014 11:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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