来自ios Client的NTLM身份validation
我在.net中有一个Web服务,它需要NTLM (基于IIS的Windows服务器)身份validation才能访问。 我如何从iOS客户端获得NTLMauthentication。
您可以创build一个NSURLConnection并实现其委托方法
- (void)连接:(NSURLConnection *)连接willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
在这个代表,检查挑战
[challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodNTLM]
如果是来自NTLM,则发送凭证
NSURLCredential *credentail = [NSURLCredential credentialWithUser:<Your username> password: <Your password> persistence:NSURLCredentialPersistenceForSession]; [[challenge sender] useCredential:credentail forAuthenticationChallenge:_challenge];