【发布时间】:2019-09-28 16:49:56
【问题描述】:
我的应用在 Azure AD 上,我正在使用以下代码在 Auth Service 上请求身份验证:
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/Home/Index" }, WsFederationAuthenticationDefaults.AuthenticationType);
发生的情况是,这在某些浏览器中有效(没有模式),有时在其他浏览器中无效。
当应用程序重定向到 /home/index 时,有时对象 User.Identity 有用户的电子邮件,但有时它没有信息。
为什么会这样?
【问题讨论】:
-
在您的问题中,您缺少用于提取电子邮件的代码。在您看来,您只是在使用标准的
@User.Identity.Name吗?Request.IsAuthenticated的状态是什么?也许你有一个错误处理程序吞下了错误? -
那么它总是在哪些浏览器中工作,有时在哪些浏览器中工作?私人浏览有什么模式吗?你的问题并没有表明很多分析
标签: asp.net-mvc authentication azure-active-directory multi-factor-authentication