> On 21 Apr 2015, at 03:28, Daryle Walker <[email protected]> wrote:
> 
> When creating a credential with username “hello” and password “there,” the 
> former URL succeeds (200) while the latter fails (401).

This works for me now, both in Safari and in code.  Here's my challenge handler:

- (void)URLSession:(NSURLSession *)session 
    task:(NSURLSessionTask *)task 
    didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge 
    completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, 
NSURLCredential *))completionHandler {
    if ( [ @[ NSURLAuthenticationMethodDefault, 
             NSURLAuthenticationMethodHTTPBasic, 
             NSURLAuthenticationMethodHTTPDigest, 
             NSURLAuthenticationMethodNTLM
         ] containsObject:challenge.protectionSpace.authenticationMethod] ) {
        completionHandler(
            NSURLSessionAuthChallengeUseCredential, 
            [NSURLCredential credentialWithUser:@"hello" password:@"there" 
persistence:NSURLCredentialPersistenceForSession
        ]);
    } else {
        completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
    }
}

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to