Skip to content

Commit

Permalink
IOS: Fixed #139: Added nullability attributes to PA2ClientSslValidati…
Browse files Browse the repository at this point in the history
…onStrategy
  • Loading branch information
hvge committed Sep 4, 2018
1 parent a4d8483 commit 31b8d74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@

@implementation PA2ClientSslNoValidationStrategy

- (void)validateSslForSession:(NSURLSession *)session
challenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
- (void) validateSslForSession:(nonnull NSURLSession *)session
challenge:(nonnull NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^ _Nonnull)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
{
// Allow any SSL certificate

PA2CriticalWarning(@"SSL validation is disabled. This code must not be present in production!");
NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
The implementation must call `completionHandler` with an appropriate result of the verification.
*/
- (void) validateSslForSession:(NSURLSession *)session
challenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler;
- (void) validateSslForSession:(nonnull NSURLSession *)session
challenge:(nonnull NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^ _Nonnull)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler;

@end

0 comments on commit 31b8d74

Please sign in to comment.