我正在使用Yahoo Owin安全提供程序使用Yahoo对我的Web应用程序用户进行身份验证。他们能够正确地进行身份验证,但Email属性始终为null。如何配置此提供程序,以便在调用AuthenticationManager.GetExternalLoginInfoAsync
后设置ExternalLoginInfo.Email属性?我的身份验证配置设置如下:
app.UseYahooAuthentication(new YahooAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Passive,
AuthenticationType = "Yahoo",
BackchannelTimeout = TimeSpan.FromSeconds(60),
Caption = "Yahoo",
ConsumerKey = yahooKey,
ConsumerSecret = yahooSecret,
Provider = new YahooAuthenticationProvider
{
OnAuthenticated = context =>
{
foreach (var claim in context.User)
{
var claimType = $"urn:yahoo:{claim.Key}";
var claimValue = claim.Value.ToString();
if (!context.Identity.HasClaim(claimType, claimValue))
context.Identity.AddClaim(new Claim(claimType, claimValue, "XmlSchemaString", "Yahoo"));
}
return Task.FromResult(0);
}
}
});
}