On Apr 18, 2015, at 10:36 PM, Daryle Walker <darylew@mac.com> wrote:
I added command-line options to include a username and password. I use them via a newly-added callback method:
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler { completionHandler(challenge.previousFailureCount ? NSURLSessionAuthChallengeRejectProtectionSpace : NSURLSessionAuthChallengeUseCredential, self.usernameAndPassword); }
Where the “usernameAndPassword” was created with “[NSURLCredential credentialWithUser:cliUserName password:cliPassWord persistence:NSURLCredentialPersistenceForSession]”.
In a different response, I mentioned that this doesn’t work for FTP resources (which do respond to in-URL username & password). It does work for HTTP, but only for Basic Authentication. Use for a Digest Authentication HTTP send fails. What am I missing in the latter case? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists... This email sent to site_archiver@lists.apple.com