|
@@ -15,6 +15,7 @@
|
15
|
15
|
|
16
|
16
|
static NSTimer *keyboardTimer;
|
17
|
17
|
static NSString *const MessageHandlerName = @"ReactNativeWebView";
|
|
18
|
+static NSURLCredential* clientAuthenticationCredential;
|
18
|
19
|
|
19
|
20
|
// runtime trick to remove WKWebView keyboard default toolbar
|
20
|
21
|
// see: http://stackoverflow.com/questions/19033292/ios-7-uiwebview-keyboard-issue/19042279#19042279
|
|
@@ -386,6 +387,25 @@ static NSString *const MessageHandlerName = @"ReactNativeWebView";
|
386
|
387
|
return [[NSMutableDictionary alloc] initWithDictionary: event];
|
387
|
388
|
}
|
388
|
389
|
|
|
390
|
++ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential {
|
|
391
|
+ clientAuthenticationCredential = credential;
|
|
392
|
+}
|
|
393
|
+
|
|
394
|
+- (void) webView:(WKWebView *)webView
|
|
395
|
+ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
|
396
|
+ completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable))completionHandler
|
|
397
|
+{
|
|
398
|
+ if (!clientAuthenticationCredential) {
|
|
399
|
+ completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
|
|
400
|
+ return;
|
|
401
|
+ }
|
|
402
|
+ if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodClientCertificate) {
|
|
403
|
+ completionHandler(NSURLSessionAuthChallengeUseCredential, clientAuthenticationCredential);
|
|
404
|
+ } else {
|
|
405
|
+ completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
|
|
406
|
+ }
|
|
407
|
+}
|
|
408
|
+
|
389
|
409
|
#pragma mark - WKNavigationDelegate methods
|
390
|
410
|
|
391
|
411
|
/**
|