Mono、NTLM 和空域
我正在使用 Mono 2.6.7 - 如果我不指定域,则请求的主机将用于 NTLM 身份验证 - 这会导致登录失败。
1 - 工作:使用用户名“domainXYZ/User123”登录 -> NTLM 软件包的 Wireshark 捕获:
Domain name: domainXYZ
User name: User123
2 - 工作:在 URL http://1.2.3.4/a 上使用用户名“User123”登录.txt -> .Net/Windows:
Domain name: NULL
User name: User123
3 - 不工作:在 URL http: 上使用用户名“User123”登录: //1.2.3.4/a.txt -> Mono/Debian:
Domain name: 1.2.3.4
User name: User123
此身份验证请求不起作用,因为目标计算机上没有名为 1.2.3.4 的域。
我的没有域信息的身份验证代码:
NetworkCredential credential = new NetworkCredential(request.Username, request.Password);
// credential = new NetworkCredential(request.Username, request.Password, null); also not working
CredentialCache credentialCache = new CredentialCache { { new Uri(request.Url), "NTLM", credential } };
webClient.Credentials = credentialCache;
有什么想法吗?
I'm using Mono 2.6.7 - if I don't specify a Domain the requested Host is taken for the NTLM Authentication - which leads to an unsuccessful login.
1 - Working: Login with Username 'domainXYZ/User123' -> Wireshark Capture of NTLM Packages:
Domain name: domainXYZ
User name: User123
2 - Working: Login with Username 'User123' on URL http://1.2.3.4/a.txt -> .Net/Windows:
Domain name: NULL
User name: User123
3 - Not Working: Login with Username 'User123' on URL http://1.2.3.4/a.txt -> Mono/Debian:
Domain name: 1.2.3.4
User name: User123
This authentication request is not working, because there is no Domain called 1.2.3.4 on the target machine.
My code for authentication without Domain information:
NetworkCredential credential = new NetworkCredential(request.Username, request.Password);
// credential = new NetworkCredential(request.Username, request.Password, null); also not working
CredentialCache credentialCache = new CredentialCache { { new Uri(request.Url), "NTLM", credential } };
webClient.Credentials = credentialCache;
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们能够采取“简单”的解决方法来解决域问题。一般来说,我们将连接实现为 Objective-C 中的“胖”静态库,为了简单起见,使用 ASIHTTPRequest 框架,按照 此处,并在 此处,我们能够包含创建的 .dll 和 .a 文件进入 MonoDevelop 并链接到所需的框架。
如果您对源文件感兴趣,请随时与我联系。
我还有一些更有趣的链接对我们有帮助,但我需要更多的声誉来发布它们。另外,请随时向我索取。
问候,
安德烈亚斯
编辑:抱歉,缺少最重要的信息。将 ASIHTTPRequest 中的域设置为空字符串
[asiRequest setDomain:@""];
并将整个请求包装在静态库中就可以了。We were able to do a "simple" workaround to solve the domain issue. In general, we implemented the connection as a "fat" static library in Objective-C, using the ASIHTTPRequest framework for simplicity, did the API binding as described here, and with some help from here, we were able to include the created .dll and .a file into MonoDevelop and link against the needed frameworks.
Feel free to contact me, if you're interested in the source files.
I also have some more interesting links that helped us, but I need some more reputation to post them. Also, feel free to ask me for them.
Regards,
Andreas
Edit: Sorry, the most important information was missing. Setting the domain in ASIHTTPRequest to an empty string
[asiRequest setDomain:@""];
and wrapping the whole request in the static library did the trick.我刚刚在 Mono master 和 mono-2-10 分支中解决了这个问题: https://github.com/mono/mono/commit/214741630f96ddd3e847ff4050182674fe2d1602
I have just fixed this problem in the Mono master and mono-2-10 branches: https://github.com/mono/mono/commit/214741630f96ddd3e847ff4050182674fe2d1602