我的 iOS 应用程序正在连接到 Sharepoint Web 服务,并且 Sharepoint 使用 NTLM 身份验证。
在我这边,我已经为 NTLM 身份验证实现了以下代码:
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge previousFailureCount] == 0)
{
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSString *username = [userDefaults valueForKey:KEY_USERNAME];
NSString *password = [userDefaults valueForKey:KEY_PASSWORD];
NSURLCredential *newCredential;
newCredential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone];
[[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
} else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
}}
所以我的问题是
- 上面代码中发送的用户名和密码是加密形式的吗?
- 如果用户名和密码处于加密模式,那么 NSURLAuthenticationChallenge 是如何加密它们的?
提前致谢