Chi*_*isu 21 impersonation windows-authentication integrated-pipeline-mode iis-7.5 windows-server-2008-r2
这个问题一直困扰着我......
在本地Intranet环境中,如果我们想要使用模拟我们的Windows域用户,我们注定要在我们的应用程序池中使用"经典"管道模式,或者是否有一种新的方式来声明性地"运行"它们(可以这么说) )?
我的目标是在我的Intranet上对本地Web应用程序使用Windows身份验证,以便用户可以在其活动目录帐户下进行身份验证和运行应用程序(原则).每次我尝试这个(当然使用NetworkService身份),我都会收到此错误:

谢谢!;)
Chi*_*isu 26
我写了一个小应用程序来显示从几个不同的地方抓取的当前用户的网络用户名,例如Page.User.Identity.Name.我还使用几种不同的方法来查询有关域用户的信息,以查询ActiveDirectory.这一切都是为了验证以下内容.
我找到了两种使用Windows身份验证运行应用程序的主要模式,根据我的研究,主要用于Intranet环境.以下是配置的最基本要素:
经典模式
集成模式
现在这里是踢球者!
如果您想使用集成模式(这是理想的,因为它产生更多的功能,以及更好的集成),您将需要启用委派.以下是一些必读文章,以了解委派的基础知识,并通过扩展动态SPN注册.由于这会涉及到您可能需要深入研究的更多Kerberos和安全注意事项,因此可能更容易坚持使用经典模式,您只需启用模拟并将其称为一天; 或者作弊和禁用validateIntegratedModeConfiguration.:P
我希望这能帮助那些有关interwebz的人.干杯! :)
Don*_*rty 12
不,但"集成"管道要求您手动模拟Windows Authenticated用户.至少在IIS8.5中,就是这样.
为什么? 经典模拟破坏了.NET的异步功能.具体来说,当多个用户同时使用该线程时,很难管理该线程的WindowsIdentity.
怎么样? 使用WindowsImpersonationContext 例如
// Start with identity assigned by IIS Application Pool
var current = System.Security.Principal.WindowsIdentity.GetCurrent();
// Enable Windows Authentication in ASP.NET *and* IIS, which ensures
// User.Identity is a WindowsIdentity
WindowsIdentity clientId = (WindowsIdentity)User.Identity;
// When 'using' block ends, the thread reverts back to previous Windows identity,
// because under the hood WindowsImpersonationContext.Undo() is called by Dispose()
using (WindowsImpersonationContext wic = clientId.Impersonate())
{
// WindowsIdentity will have changed to match clientId
current = System.Security.Principal.WindowsIdentity.GetCurrent();
}
// Back to the original identity
current = System.Security.Principal.WindowsIdentity.GetCurrent();
Run Code Online (Sandbox Code Playgroud)
问题? 有时您需要使用委派而不是模仿.
| 归档时间: |
|
| 查看次数: |
22058 次 |
| 最近记录: |