問題描述
如果您有一個將在網絡內運行的 Web 應用程序,那么它支持 Windows 身份驗證(活動目錄?)是有意義的.
If you have a web application that will run inside a network, it makes sense for it to support windows authentication (active directory?).
使用 AD 安全模型是否有意義,或者我是否會創建自己的角色/安全模塊,某些管理員必須為每個用戶配置?
Would it make sense to use AD security model as well, or would I make my own roles/security module that some admin would have to configure for each user?
我以前從未處理過 Windows 安全性,所以我很困惑我應該如何處理在 Windows 網絡中運行的 Web 應用程序的安全性.
I've never dealt with windows security before, so I am very confused as to how I should be handling security for a web application that runs within a windows network.
我想我必須解決兩個主要問題:
I guess there are 2 major points I have to tackle:
1. authentication
2. authorization
我有一種感覺,最佳實踐會說自己處理授權,但使用 AD 身份驗證對嗎?
I have a feeling that best-practice would say to handle authorization myself, but use AD authentication right?
推薦答案
基本上 windows 處理一切,你從不存儲用戶名或密碼,AD 和 IIS 為你做所有的工作
Basically windows handles everything, you never store usernames or passwords, AD and IIS do all the work for you
將此添加到您的 web.config
<system.web>
...
<authentication mode="Windows"/>
...
</system.web>
配置 Windows 身份驗證
To configure Windows authentication
- 啟動 Internet 信息服務(IIS).
- 右鍵單擊您的應用程序的虛擬目錄,以及然后單擊屬性.
- 點擊目錄安全選項卡.
- 下匿名訪問和身份驗證控件,單擊編輯.
- 確保匿名訪問復選框不是選擇和集成Windows身份驗證是唯一的選擇復選框.
然后您可以再次使用 web.config
處理業務或授權.例如
You can then deal with the business or authorization using web.config
again. for example
<authorization>
<deny users="DomainNameUserName" />
<allow roles="DomainNameWindowsGroup" />
</authorization>
在此處閱讀更多信息:http://msdn.microsoft.com/en-我們/圖書館/ms998358.aspx
這篇關于Web 應用程序使用窗口域帳戶進行身份驗證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!