如何在 ASP.NET MVC 3 Intranet 应用程序中重新验证用户身份?

发布于 2024-12-07 04:19:28 字数 487 浏览 0 评论 0原文

该应用程序已经使用 Windows 集成安全性,而不是 Forms。我想要完成的是所谓的“逐步”身份验证,或“强制重新身份验证”,适用于以下场景:

  1. 用户正在浏览网站,
  2. 突然做一些常见的、琐碎的事情,用户必须执行敏感操作比如授权 资源分配或确认汽车贷款或类似的操作,
  3. 在用户被重定向到之前,系统会提示用户输入凭据 敏感页面,其方式类似于 SharePoint 的“登录身份” 不同的用户”
  4. 当且仅当输入的凭据是 与当前登录用户的应用程序相同 继续前往敏感区域。

这可以防止以下两个问题:

  1. 用户去开会或喝咖啡时忘记锁定 工作站和同事使用会话来访问敏感信息 区域
  2. 用户输入他或她老板的凭据(因为,让我们 假设他从老板的肩膀上偷看)以进入敏感区域。

我知道,有些人会认为这是“偏执”,但也有些人会说这是常识,应该在某个地方的框架中构建(jQuery 或 .NET)

The application is already using Windows integrated security, not Forms. What I am trying to accomplish is a so called "step-up" authentication, or "force re-authentication" for the following scenario:

  1. the user is browsing the site doing common, trivial stuff
  2. suddenly, the user has to do a sensitive action such as authorizing
    a resource allocation or confirming a car loan or something similar
  3. the user is prompted for the credential before (s)he's redirected to
    the sensitive page, in a manner similar to SharePoint's "Sign In as
    a Different User"
  4. if, and only if, the credentials entered are
    the same as for the currently logged-in user the application
    proceeds to the sensitive area.

This would prevent the following two issues:

  1. The user goes for a meeting or a coffee and forgets to lock the
    workstation and a colleague uses the session to access the sensitive
    area
  2. The user enters the credentials of his or her boss (because, let's
    say he peeked over the boss' shoulder) to access the sensitive area.

I know, some would look at this as "being paranoid", but also some would say it's common sense and should be build in a framework somewhere (jQuery or .NET)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情丝乱 2024-12-14 04:19:28

让表单发送凭据以及执行操作的请求,即某些操作要求您提供用户名/密码。使用 PrimaryContext ValidateCredentials 方法确保输入了正确的凭据并检查提供的用户名是否与 User.Identity 对象中的当前用户名匹配。

public ActionResult SensitiveAction( SensitiveModel model, string username, string password )
{
    using (var context = new PrincipalContext(ContextType.Domain))
    {
         if (!string.Equals(this.User.Identity.Name,username,StringComparison.OrdinalIgnoreCase)
             || !context.ValidateCredentials(username,password))
         {
              return View("PermissionDenied");
         }
    }

    ...
}

Have the form send the credentials along with the request to perform the action, i.e., some actions require that you provide username/password. Use the PrincipalContext ValidateCredentials method to ensure that the proper credentials have been entered and check that the username supplied matches the current username in the User.Identity object.

public ActionResult SensitiveAction( SensitiveModel model, string username, string password )
{
    using (var context = new PrincipalContext(ContextType.Domain))
    {
         if (!string.Equals(this.User.Identity.Name,username,StringComparison.OrdinalIgnoreCase)
             || !context.ValidateCredentials(username,password))
         {
              return View("PermissionDenied");
         }
    }

    ...
}
忆伤 2024-12-14 04:19:28

用户去开会或喝咖啡时忘记锁定工作站,同事使用会话访问敏感区域

这仅在第一次有效,但现在老板进入敏感区域,重新输入她的凭据,然后继续咖啡。您会提示每个敏感请求吗?用户不会忍受这一点。

用户输入其老板的凭据(因为,假设他从老板的肩膀上偷看)以访问敏感区域。

如果有人知道并输入其老板的凭据,您将无法检测到这一点。

The user goes for a meeting or a coffee and forgets to lock the workstation and a colleague uses the session to access the sensitive area

That works only the first time, but now the boss enters a sensitive area, re-enters her credentials, then goes for coffee. Are you going to prompt for every sensitive request? Users won't put up with that.

The user enters the credentials of his or her boss (because, let's say he peeked over the boss' shoulder) to access the sensitive area.

If someone knows and enters the credentials of their boss, there is nothing you can do to detect that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文