gpt4 book ai didi

c# - DpapiDataProtectionProvider构造函数中appName有什么影响

转载 作者:太空狗 更新时间:2023-10-29 20:33:13 26 4
gpt4 key购买 nike

在我们的 IdentityManager 类中,我们有以下行:

protectionProvider = new DpapiDataProtectionProvider("OurProduct");

最后一个参数的含义是什么,它与网站在 IIS 上的设置方式有什么关系吗?

背景:长期以来,我们一直在将带有自定义 IdentityManager 类的 MVC5 站点轻松部署到验证环境,现在我们在尝试重置用户密码时遇到以下问题:

System.Security.Cryptography.CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.

以下线程中描述了一些解决方案: Generating reset password token does not work in Azure Website

一切都位于同一台机器上:IIS、Sql Server、Firefox 测试浏览器。

不幸的是,我没有完全掌握这些概念,我正试图弄清楚测试环境是如何改变的,以便在以前从未发生过的地方触发这个问题?

最佳答案

由于我是来这里寻找这个并且没有答案,所以我决定看一下代码。看起来 DataProtector.cs 使用应用程序名称(以及主要用途和特定用途)来创建 SHA 256 哈希。

因为哈希是 one way street ,把你想要的任何东西放在那里应该是相当安全的。我想越复杂越好,但应用程序的名称应该没问题。

希望这对其他过于偏执的人有所帮助。

关于c# - DpapiDataProtectionProvider构造函数中appName有什么影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36447455/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com