我正在制作一个 ASP.NET 网站并正在使用Forms Authentication
;我正在为所有安全部分使用自定义提供程序(优秀的 TinyProviders 基于 xml 的数据提供程序)。
目前,用户数据存储(一个名为 Users.xml 的 xml 文件)包含完全未加密的数据:
<?xml version="1.0"?>
<ArrayOfXmlUser xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<XmlUser>
<UserKey>a34cc5b6-a0b9-4a5e-b055-951w799a8607</UserKey>
<UserName>Bill</UserName>
<Password>billspassword123</Password>
<PasswordSalt />
<Email>bill@contoso.com</Email>
<PasswordQuestion />
<PasswordAnswer />
<CreationDate>2013-03-14T21:46:36.7990912+00:00</CreationDate>
<LastActivityDate>2013-03-14T21:47:50.3483942+00:00</LastActivityDate>
<LastLoginDate>2013-03-14T21:47:50.3483942+00:00</LastLoginDate>
<LastPasswordChangeDate>2013-03-14T21:46:36.7990912+00:00</LastPasswordChangeDate>
<LastLockoutDate>9999-12-31T23:59:59.9999999</LastLockoutDate>
<IsApproved>true</IsApproved>
<IsLockedOut>false</IsLockedOut>
<FailedPasswordAttemptCount>0</FailedPasswordAttemptCount>
</XmlUser>
</ArrayOfXmlUser>
我如何配置网站以执行以下操作:
- 存储密码哈希(而不是纯文本)
- 加密用户文件中的所有(或最好是电子邮件和姓名)数据
我希望从我那里做到这一点,Web.config
因为我使用的是 TinyProvider 的二进制发行版。
这是我Web.config
到目前为止:
<?xml version="1.0" encoding="utf-8"?>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<profile enabled="true" defaultProvider="XmlProfileProvider">
<providers>
<clear/>
<add name="XmlProfileProvider"
applicationName="SampleWebsite"
type="Artem.Web.Security.XmlProfileProvider"/>
</providers>
</profile>
<membership defaultProvider="XmlMembershipProvider">
<providers>
<clear/>
<add name="XmlMembershipProvider"
applicationName="SampleWebsite"
type="Artem.Web.Security.XmlMembershipProvider"
minRequiredPasswordLength="1"
minRequiredNonAlphanumericCharacters="0"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Clear"/>
</providers>
</membership>
<roleManager enabled="true" cacheRolesInCookie="false" defaultProvider="XmlRoleProvider">
<providers>
<clear/>
<add name="XmlRoleProvider"
applicationName="SampleWebsite"
type="Artem.Web.Security.XmlRoleProvider"/>
</providers>
</roleManager>