NTLM 作为 SSO,并作为模拟管理员执行某些操作
我似乎无法偶然发现 IIS / ASP.NET 设置的正确组合来完成以下任务:
- 内部域上的所有用户都应该能够访问 IIS 站点(使用 NTLM 身份验证),并且 ASP.NET 应用程序应该能够获取当前用户的用户名(又名用户被验证为自己)。
- 正在运行的 ASP.NET 应用程序应该能够在管理员帐户下执行某些操作。例如,Active Directory 更改或将文件写入受限位置。
您可能会猜到,但该应用程序的重点是能够让“普通”用户通过 Web 应用程序进行特定的“管理”更改。同时,应使用“普通”用户的帐户记录更改,因此我不想丢失经过身份验证的用户的凭据。
寻找 IIS6 中的特定设置来完成 #1(域中的任何用户访问该站点并以自己的身份进行身份验证),以及 #2 的代码。
I can't seem to stumble upon the correct combination of IIS / ASP.NET settings to accomplish the following:
- All users on an internal domain should be able to access IIS site (w/ NTLM authentication), and the ASP.NET application should be able to get the username of the current user (aka the user is authenticated as themselves).
- The running ASP.NET application should be able to execute certain actions under an Administrator account. For example, an Active Directory change, or writing files to restricted locations.
You could probably guess, but the point of the application is to be able to let "normal" users make specific "Administrative" changes via the web application. At the same time, the change should be logged with the "normal" user's account, so I don't want to lose the authenticated user's credentials.
Looking for the specific settings in IIS6 to accomplish #1 (any users on the domain to get to the site and be authenticated as themselves), along with the code for #2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至少有两个选项:
两者通用:
选项 1:
选项 2:
对于选项 2,以下是使用模拟用户的代码示例:
http://msdn.microsoft.com/en-us/library/system.security.principal.windowsimpersonationcontext.aspx
There are atleast two options:
Common for both:
Option 1:
Option 2:
For option 2, here is a code example that uses impersonate user:
http://msdn.microsoft.com/en-us/library/system.security.principal.windowsimpersonationcontext.aspx
从安全角度来看,最好的方法是将所有管理操作分离到其自己的 Web 服务中,该服务进行身份验证,但不进行模拟。站点的正常部分将通过调用 Web 服务来执行管理操作,就像任何其他客户端一样,即使是本地主机调用。
通过这种方式,您可以实现普通应用程序池(模拟)和特权应用程序池(管理)之间的隔离。
最后,这可能是吹毛求疵,但它应该是 Kerberos 身份验证,而不是 NTLM,因为 NTLM 不允许 约束委派,如果您的“普通”应用程序访问本地 IIS 主机之外的任何内容,则需要启用委派。
From a security point of view, the best approach would be to separate all the Administrative operations into its own Web service that does authenticate, but does not impersonate. Your Normalpart of the site would perform the administrative operations by calling the web service, just like any other client, even if is a localhost call.
This way you achieve isolation between the normal app pool (that impersonates) and the priviledged app pool (the administrative).
Finally, this is perhaps splitting hairs, but it should be Kerberos authentication, not NTLM, because NTLM does not allow for constrained delegation and your 'normal' application will need to be enabled for delegation if it accesses anything outside the local IIS host.