|
4 | 4 | #import <Security/Security.h>
|
5 | 5 |
|
6 | 6 | /**
|
7 |
| - * There will be only one instance of this class on runtime accordinly the React Native code. |
| 7 | + * There will be only one instance of this class at runtime according to the React Native code. |
8 | 8 | * This provides a good opportunity to cache data on the class itself.
|
9 | 9 | */
|
10 | 10 | @implementation RCTHTTPRequestHandler (AuthenticationChallengeExtension)
|
@@ -110,15 +110,15 @@ - (void)authenticationChallenge_URLSession:(NSURLSession *)session
|
110 | 110 | completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
|
111 | 111 | }
|
112 | 112 | } else {
|
113 |
| - NSLog(@"Certificate not set."); |
| 113 | + CFStringRef errorMessage = SecCopyErrorMessageString(status, NULL); |
| 114 | + NSLog(@"Certificate not set to the trust entity. Reason: %@", (__bridge NSString *)errorMessage); |
114 | 115 | // Cancel the authentication challenge
|
115 | 116 | completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
|
116 | 117 | }
|
117 | 118 | } else {
|
118 | 119 | // Trust is not of type ServerTrust, proceeding with default challenge, if any
|
119 | 120 | NSLog(@"Not ServerTrust challenge. Calling default authentication challenge.");
|
120 |
| - // For other authentication methods, call the original implementation |
121 |
| - [self authenticationChallenge_URLSession:session didReceiveChallenge:challenge completionHandler:completionHandler]; |
| 121 | + completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); |
122 | 122 | }
|
123 | 123 | }
|
124 | 124 |
|
@@ -151,7 +151,7 @@ - (SecCertificateRef)getCert:(NSString *)certFilename {
|
151 | 151 |
|
152 | 152 | if (!certData) {
|
153 | 153 | @throw [NSException exceptionWithName:NSInternalInconsistencyException
|
154 |
| - reason:[NSString stringWithFormat:@"%@ not found", certFilename] |
| 154 | + reason:[NSString stringWithFormat:@"Certificate file %@.der not found", certFilename] |
155 | 155 | userInfo:nil];
|
156 | 156 | }
|
157 | 157 |
|
|
0 commit comments