Add GitHub Email information
Add information about GitHub email to the context
This commit is contained in:
@@ -103,6 +103,10 @@ namespace Owin.Security.Providers.GitHub
|
||||
{
|
||||
context.Identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, context.UserName, XmlSchemaString, Options.AuthenticationType));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(context.Email))
|
||||
{
|
||||
context.Identity.AddClaim(new Claim(ClaimTypes.Email, context.Email, XmlSchemaString, Options.AuthenticationType));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(context.Name))
|
||||
{
|
||||
context.Identity.AddClaim(new Claim("urn:github:name", context.Name, XmlSchemaString, Options.AuthenticationType));
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Owin.Security.Providers.GitHub
|
||||
Name = TryGetValue(user, "name");
|
||||
Link = TryGetValue(user, "url");
|
||||
UserName = TryGetValue(user, "login");
|
||||
Email = TryGetValue(user, "email");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,6 +65,11 @@ namespace Owin.Security.Providers.GitHub
|
||||
/// </summary>
|
||||
public string UserName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GitHub email
|
||||
/// </summary>
|
||||
public string Email { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="ClaimsIdentity"/> representing the user
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user