Merge branch 'master' of https://github.com/adib/asi-http-request into adib-master
Showing
1 changed file
with
24 additions
and
0 deletions
| @@ -2403,6 +2403,30 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2403,6 +2403,30 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2403 | 2403 | ||
| 2404 | // If we have a username and password, let's apply them to the request and continue | 2404 | // If we have a username and password, let's apply them to the request and continue |
| 2405 | if (user && pass) { | 2405 | if (user && pass) { |
| 2406 | + // --- BEGIN adib 7-Jan-2011 | ||
| 2407 | + // set domain for NTLM | ||
| 2408 | + { | ||
| 2409 | + NSString* authScheme = [self proxyAuthenticationScheme]; | ||
| 2410 | + if ([authScheme isEqualToString:(NSString*) kCFHTTPAuthenticationSchemeNTLM]) { | ||
| 2411 | + NSString* ntlmDomain = [self proxyDomain]; | ||
| 2412 | + if (!ntlmDomain || [ntlmDomain length] == 0) { | ||
| 2413 | + // try to extract the domain from the user name if its in the form DOMAIN\username | ||
| 2414 | + NSArray* ntlmComponents = [user componentsSeparatedByString:@"\\"]; | ||
| 2415 | + if (ntlmComponents.count == 2) { | ||
| 2416 | + NSString* domainName = [ntlmComponents objectAtIndex:0]; | ||
| 2417 | + NSString* userName = [ntlmComponents objectAtIndex:1]; | ||
| 2418 | + | ||
| 2419 | + user = userName; | ||
| 2420 | + ntlmDomain = domainName; | ||
| 2421 | + } | ||
| 2422 | + } | ||
| 2423 | + if (ntlmDomain) { | ||
| 2424 | + [newCredentials setObject:ntlmDomain forKey: (NSString*) kCFHTTPAuthenticationAccountDomain]; | ||
| 2425 | + } | ||
| 2426 | + } | ||
| 2427 | + | ||
| 2428 | + } | ||
| 2429 | + // --- END adib 7-Jan-2011 | ||
| 2406 | 2430 | ||
| 2407 | [newCredentials setObject:user forKey:(NSString *)kCFHTTPAuthenticationUsername]; | 2431 | [newCredentials setObject:user forKey:(NSString *)kCFHTTPAuthenticationUsername]; |
| 2408 | [newCredentials setObject:pass forKey:(NSString *)kCFHTTPAuthenticationPassword]; | 2432 | [newCredentials setObject:pass forKey:(NSString *)kCFHTTPAuthenticationPassword]; |
-
Please register or login to post a comment