[ASP.NET 2.0 Security FAQs]如何在membership中強制使用高安全性的密碼

來源:互聯網
上載者:User
[ASP.NET 2.0 Security FAQs]目錄

原文連結

翻譯:2005-12-10  by  Jackie Lin

你可以在membership裡配置minRequiredPasswordLength, minRequiredNonAlphanumericCharacters, 和 passwordStrengthRegularExpression 屬性,來強制使用安全性高的密碼.

安全性高的密碼可以用來防止壓力攻擊(brute force attacks)和字典攻擊(dictionary attacks).

SqlMembershipProvider 和ActiveDirectoryMembershipProvider 的預設密碼強度配置為:最少7個字元,其中最少有1個非字母數位字元 .

如果你是在活動目錄(AD)中使用ActiveDirectoryMembershipProvider , 你的域密碼組策略(domain password policy)會預設的被使用, 不過你可以在你的程式裡配置membership以覆蓋相關的配置. 同樣的, 如果你是在ADAM中使用ActiveDirectoryMembershipProvider , 你的本地密碼組策略(local password policy)會預設被使用, 你也可以配置membership覆蓋相關的配置.

你可以使用Regex來配置特別的密碼強度規則, 或者你也可以配置密碼中數字、字元、字母的最小最大長度.

使用Regex

<membership>
<providers>
   <add passwordStrengthRegularExpression= 
                    "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$" />
 </providers>
</membership>

使用最小的非字母數字字元長度

<membership>
 <providers>
   <add minRequiredPasswordLength=10 minRequiredNonalphanumericCharacters=2 />
 </providers>
</membership>

譯者註:以上均在web.config檔案中配置

更多資訊

更多關於強密碼的資訊請參考:"How To: Protect Forms Authentication in ASP.NET 2.0"  http://msdn.microsoft.com/library/en-us/dnpag2/html/PAGHT000012.asp

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.