作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在我们的 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/
我是一名优秀的程序员,十分优秀!