简体   繁体   English

来自ios客户端的NTLM身份验证

[英]NTLM authentication from ios Client

I have a web-service in .net , that requires NTLM (Windows based in IIS Server) authentication before it can be access . 我在.net中有一个Web服务,该服务需要NTLM (基于IIS的Windows)才能进行访问。 How would I get NTLM-authenticated from iOS Client. 我如何从iOS客户端获得NTLM认证。

You can create a NSURLConnection and implement its delegate method 您可以创建一个NSURLConnection并实现其委托方法

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

In this delegate, check the challenge 在此代表中,检查挑战

[challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM]

if it is from the NTLM, then send the credential 如果来自NTLM,则发送凭据

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM