来自ios客户端的NTLM身份验证 [英] NTLM authentication from ios Client

查看:163
本文介绍了来自ios客户端的NTLM身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.net中有一个Web服务,需要进行 NTLM (基于Windows的IIS IIS)身份验证才能访问它.我如何从iOS客户端获得 NTLM认证.

I have a web-service in .net , that requires NTLM (Windows based in IIS Server) authentication before it can be access . How would I get NTLM-authenticated from iOS Client.

推荐答案

您可以创建NSURLConnection并实现其委托方法

You can create a NSURLConnection and implement its delegate method

  • (无效)连接:(NSURLConnection *)连接 willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)挑战
  • (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

在此代表中,检查挑战

[challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM]

如果来自NTLM,则发送凭据

if it is from the NTLM, then send the credential

NSURLCredential *credentail = [NSURLCredential
                                   credentialWithUser:<Your username>
                                   password: <Your password>
                                   persistence:NSURLCredentialPersistenceForSession];

[[challenge sender] useCredential:credentail forAuthenticationChallenge:_challenge];

这篇关于来自ios客户端的NTLM身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆