将我的网站移动到不同的服务器会将身份验证从 Kerberos 更改为 NTLM
我有一个配置为 Windows 身份验证的 Web 服务。调用 WS 的客户端代码将凭据传递给 WS,如下所示:(
myWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
我的理解是,这代表登录用户的用户名-密码-域)。
我正在测试配置问题,并对如何确保设置 Kerberos 感到困惑。
详细信息如下:
我在同一个 IIS 服务器上有 2 个虚拟目录(一个是带有 .aspx 页面的“客户端”),另一个是“服务器”(它托管客户端调用的 Web 服务)。
我的客户端通过以下代码显示有关连接用户的关键信息:
private string GetUserInfo()
{
System.Security.Principal.WindowsIdentity UserIdentityInfo;
StringBuilder msg = new StringBuilder("User Name: ");
UserIdentityInfo = System.Security.Principal.WindowsIdentity.GetCurrent();
msg.Append(UserIdentityInfo.Name);
msg.Append(Environment.NewLine);
msg.Append(" Token: ");
msg.Append(UserIdentityInfo.Token.ToString());
msg.Append(Environment.NewLine);
msg.Append(" Authenticated: ");
msg.Append(UserIdentityInfo.AuthenticationType);
msg.Append(Environment.NewLine);
msg.Append(" System: ");
msg.Append(UserIdentityInfo.IsSystem);
msg.Append(Environment.NewLine);
msg.Append(" Guest: ");
msg.Append(UserIdentityInfo.IsGuest);
msg.Append(Environment.NewLine);
msg.Append(" Anonymous: ");
msg.Append(UserIdentityInfo.IsAnonymous);
msg.Append(Environment.NewLine);
return msg.ToString();
}
当 Web 客户端和被调用的 Web 服务位于同一服务器(例如 SERVER1)上时,身份验证类型为 Kerberos。实际执行也正确。
当调用相同的 Web 客户端代码时,身份验证类型更改为 NTLM,但它现在驻留在 SERVER2 上。被调用的Web服务仍然驻留在原始服务器(SERVER1)上。由于凭据不正确,实际执行失败。
SERVER1 和 SERVER2 位于同一局域网(同一域),并且我用于测试上述每个场景的域帐户是相同的(我位于每台计算机上的管理员组中)。
我如何配置它,以便 KERBEROS 成为身份验证类型 - 也就是说,当“我”从浏览器调用 SERVER2 上的此客户端时?
I have a webservice that is configured for Windows Authentication. The client code that invokes the WS passes along the credentials to the WS as follows:
myWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
(my understanding is that this represents the username-password-domain of logged on user).
I am testing configuration issues and confused about how to ensure Kerberos is set.
DETAILS Follow:
I have 2 virtual directories on the same IIS server (one is a "client" with .aspx pages) and the other is the "server" (it hosts a webservice that the client invokes).
My client displays key info about the connecting user via this code:
private string GetUserInfo()
{
System.Security.Principal.WindowsIdentity UserIdentityInfo;
StringBuilder msg = new StringBuilder("User Name: ");
UserIdentityInfo = System.Security.Principal.WindowsIdentity.GetCurrent();
msg.Append(UserIdentityInfo.Name);
msg.Append(Environment.NewLine);
msg.Append(" Token: ");
msg.Append(UserIdentityInfo.Token.ToString());
msg.Append(Environment.NewLine);
msg.Append(" Authenticated: ");
msg.Append(UserIdentityInfo.AuthenticationType);
msg.Append(Environment.NewLine);
msg.Append(" System: ");
msg.Append(UserIdentityInfo.IsSystem);
msg.Append(Environment.NewLine);
msg.Append(" Guest: ");
msg.Append(UserIdentityInfo.IsGuest);
msg.Append(Environment.NewLine);
msg.Append(" Anonymous: ");
msg.Append(UserIdentityInfo.IsAnonymous);
msg.Append(Environment.NewLine);
return msg.ToString();
}
Authentication type is Kerberos when BOTH webclient and the called webservice are on the same server (eg. SERVER1). Actual execution works correctly too.
Authentication type changes to NTLM when this same webclient code in invoked but it now resides on SERVER2. The called webservice still resides on the original server (SERVER1). Actual execution FAILS because the credentials are not correct.
SERVER1 and SERVER2 are on the same local area network (same DOMAIN) and the domain account I use for testing each scenario above is the same (I am in Administrators group on each machine).
How can I configure this so KERBEROS is the authentication type - that is, when this client on SERVER2 is invoked from a browser by "me"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅我上面的评论。 ServerFault 网站可能是解决这个问题的更好地方,果然那里的帖子很快就得到了很好的回答。答案:
https://serverfault .com/questions/270293/将我的网站移动到不同的服务器更改身份验证从kerberos到ntl
Please see my comment above. ServerFault site is perhaps better place for this question and sure enough a post there was quickly answered beautifully. Answer at:
https://serverfault.com/questions/270293/moving-my-website-to-different-server-changes-authentication-from-kerberos-to-ntl