0

In my NSURLConnectionDelegate instance, when the connection receives a 401 Unauthorized response to an HTTP request which contains an authentication challenge header corresponding to one of the documented supported authentication methods (e.g. WWW-Authenticate: Basic for NSURLAuthenticationMethodHTTPBasic) then my connection:canAuthenticateAgainstProtectionSpace: method is called as I'd expect.

However, I also need to be able to authenticate against authentication methods that are not listed as supported out of the box, e.g. I might get the challenge header WWW-Authenticate: XAuth7, and when this occurs the connection:canAuthenticateAgainstProtectionSpace: method is not called.

I'm guessing that this is because it doesn't know what the authentication method is, but I'd ideally like the ability to handle it by adding support, or even just getting the raw challenge header and handling it in the connection delegate.

Is this a fundamental limit of the Cocoa (iOS) libraries in that they are not extensible to additional authentication methods, or is there some way of plugging in support for additional ones?


Please note that I'm using deprecated connection delegate methods because I need to support iOS 4.3 for which they are still the up-to-date solution, but the same issue applies to the more modern connection:willSendRequestForAuthenticationChallenge: in that it is also not called for 'unsupported' authentication methods.

Greg Beech
  • 133,383
  • 43
  • 204
  • 250

0 Answers0