【问题标题】:NTLM authentication from ios Client来自 ios 客户端的 NTLM 身份验证
【发布时间】:2014-02-17 09:25:38
【问题描述】:

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

【问题讨论】:

标签: ios iphone objective-c soap webservice-client


【解决方案1】:

你可以创建一个 NSURLConnection 并实现它的委托方法

  • (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)挑战

在这个委托中,检查挑战

[challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM]

如果来自 NTLM,则发送凭证

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

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

【讨论】:

猜你喜欢
  • 2011-08-17
  • 1970-01-01
  • 1970-01-01
  • 2022-10-13
  • 1970-01-01
  • 2020-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多