SITUATION
You have a few of options to fully customize the authentication handling:
Utilize setWillSendRequestForAuthenticationChallengeBlock:
and setAuthenticationAgainstProtectionSpaceBlock:
from class AFURLConnectionOperation
and set corresponding blocks where you can tailor the mechanism you require.
The headers contain documentation.
Override connection:willSendRequestForAuthenticationChallenge:
in a subclass of AFURLConnectionOperation
. This will effectively override the complete authentication mechanism setup in AFNetworking.
Note, that you cannot disable the "server validates client identity" authentication challenge -- this is part of the server. You MUST provide the correct credentials for the requested authentication method.
Try this.
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
SecTrustRef trust = challenge.protectionSpace.serverTrust;
NSURLCredential *cred;
cred = [NSURLCredential credentialForTrust:trust];
[challenge.sender useCredential:cred forAuthenticationChallenge:challenge];
}