parent
287c889943
commit
0d45fe73d7
|
|
@ -27,7 +27,15 @@ namespace Microsoft.AspNetCore.Authentication.MicrosoftAccount
|
|||
ClaimActions.MapJsonKey(ClaimTypes.Name, "displayName");
|
||||
ClaimActions.MapJsonKey(ClaimTypes.GivenName, "givenName");
|
||||
ClaimActions.MapJsonKey(ClaimTypes.Surname, "surname");
|
||||
ClaimActions.MapCustomJson(ClaimTypes.Email, user => user.GetString("mail") ?? user.GetString("userPrincipalName"));
|
||||
ClaimActions.MapCustomJson(ClaimTypes.Email, user =>
|
||||
{
|
||||
var mail = user.GetString("mail");
|
||||
if (string.IsNullOrEmpty(mail))
|
||||
{
|
||||
mail = user.GetString("userPrincipalName");
|
||||
}
|
||||
return mail;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ namespace Microsoft.AspNetCore.Authentication.Tests.MicrosoftAccount
|
|||
displayName = "Test Name",
|
||||
givenName = "Test Given Name",
|
||||
surname = "Test Family Name",
|
||||
mail = "Test email"
|
||||
mail = "",
|
||||
userPrincipalName = "Test email"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue