【问题标题】:Can User.Identity.GetUserId() be faked by a user?用户可以伪造 User.Identity.GetUserId() 吗?
【发布时间】:2023-03-27 00:43:02
【问题描述】:

User.Identity.GetUserId() 可以被用户伪造吗?或者假设它总是返回一个用户存在或 null 的UserId 是否安全?

【问题讨论】:

    标签: c# asp.net-mvc asp.net-identity


    【解决方案1】:

    找到与您的问题相关的有用信息。 How to get current user, and how to use User class in MVC5?

    【讨论】:

      【解决方案2】:

      使用 ASP.Net Identity,这些详细信息是由 Web 服务器加密并存储在 cookie 中的声明。

      它有多安全?内容过于宽泛且基于观点,无法进入此处,但这可能具有一定的相关性:How secure is ASP.NET Identity session cookie?

      可以说,用户发送虚假用户 ID 绝非易事。

      【讨论】:

      • 我想如果具有指定 id 的用户确实存在,我将不得不检查数据库,以避免 100% 的假 cookie。
      猜你喜欢
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-21
      • 1970-01-01
      • 2018-12-12
      • 2010-10-02
      • 1970-01-01
      相关资源
      最近更新 更多