Skip to content

Commit 2e8fa00

Browse files
authored
Revert "Revert "fix(webview): authenticationMethod NSURLAuthenticationMethodClientCertificate not handled correctly (#13352)" (#13354)" (#13367)
This reverts commit 827752f.
1 parent 1325f1a commit 2e8fa00

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

iphone/Classes/TiUIWebView.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,13 @@ - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAut
880880
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
881881
}
882882
// HTTPS in general
883-
} else if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
883+
} else if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]
884+
|| [authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]) {
884885
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
885886
// Default: Reject authentication challenge
886887
} else {
888+
// Not sure why not let the DefaultHandling handle this but at least warn in the log because of canceled challenge
889+
NSLog(@"[WARN] Ti.UI.WebView canceled unknown authentication challenge with method %@", authenticationMethod);
887890
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
888891
}
889892
}

tests/Resources/ti.ui.webview.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -950,4 +950,24 @@ describe('Titanium.UI.WebView', function () {
950950
win.open();
951951
});
952952
});
953+
954+
it('url with clientCertChallenge', function (finish) {
955+
const url = 'https://device.login.microsoftonline.com';
956+
957+
win = Ti.UI.createWindow();
958+
const webView = Ti.UI.createWebView({
959+
url: url
960+
});
961+
962+
webView.addEventListener('error', function () {
963+
finish(new Error('clientCertChallenge must be handled correctly.'));
964+
});
965+
966+
webView.addEventListener('load', function () {
967+
finish();
968+
});
969+
970+
win.add(webView);
971+
win.open();
972+
});
953973
});

0 commit comments

Comments
 (0)