зеркало из https://github.com/github/AFNetworking.git
Adds `AFSSLPinningModeNone`.
This commit is contained in:
Родитель
effd1136d2
Коммит
1bfed80989
|
@ -86,6 +86,7 @@
|
|||
|
||||
#ifdef _AFNETWORKING_PIN_SSL_CERTIFICATES_
|
||||
typedef enum {
|
||||
AFSSLPinningModeNone,
|
||||
AFSSLPinningModePublicKey,
|
||||
AFSSLPinningModeCertificate,
|
||||
} AFURLConnectionOperationSSLPinningMode;
|
||||
|
|
|
@ -579,6 +579,24 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe
|
|||
|
||||
break;
|
||||
}
|
||||
case AFSSLPinningModeNone: {
|
||||
#ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_
|
||||
NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
|
||||
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
|
||||
#else
|
||||
SecTrustResultType result = 0;
|
||||
OSStatus status = SecTrustEvaluate(serverTrust, &result);
|
||||
NSAssert(status == noErr, @"SecTrustEvaluate error: %ld", (long int)status);
|
||||
|
||||
if (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed) {
|
||||
NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
|
||||
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
|
||||
} else {
|
||||
[[challenge sender] cancelAuthenticationChallenge:challenge];
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче