我有一个可以使用KentorAuthServices & Owin对Azure进行身份验证的工作配置,但我需要了解有关刚刚登录的用户的一些基本信息。当我使用WSFed作为身份验证服务时,我可以简单地处理SecurityTokenValidated通知,如下所示。我如何对KentorAuthServices进行类似的操作?我看不出有适当的通知来提取这些信息。我所需要的只是用户登录的用户名/电子邮件地址。
Notifications = new WsFederationAuthenticationNotifications
{
SecurityTokenValidated = context =>
{
string username = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.Name).Value;
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(60), true, "");
String encryptedTicket = FormsAuthentication.Encrypt(authTicket);
context.Response.Cookies.Append(FormsAuthentication.FormsCookieName, encryptedTicket);
return Task.FromResult(0);
}
}埃塔:做一些更深入的调查,我相信AcsCommandResultCreated是我想要连接的通知--但这不会触发吗?
发布于 2017-11-14 10:44:59
SAML响应中的所有信息都转换为结果标识中的声明。如果使用带有ASP.Net标识的默认模板,则可以访问AccountController上的ExternalLoginCallback操作中的外部标识。
AcsCommandResultCreated通知肯定应该在成功的登录上触发。尝试启用Katana日志记录,并查看登录序列是否由于错误而中止。
https://stackoverflow.com/questions/47275193
复制相似问题