Skip to content

Commit

Permalink
Revert "Revert "fix(webview): authenticationMethod NSURLAuthenticatio…
Browse files Browse the repository at this point in the history
…nMethodClientCertificate not handled correctly (#13352)" (#13354)" (#13367)

This reverts commit 827752f.
  • Loading branch information
hansemannn authored Apr 4, 2022
1 parent 1325f1a commit 2e8fa00
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,13 @@ - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAut
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
}
// HTTPS in general
} else if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
} else if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]
|| [authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]) {
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
// Default: Reject authentication challenge
} else {
// Not sure why not let the DefaultHandling handle this but at least warn in the log because of canceled challenge
NSLog(@"[WARN] Ti.UI.WebView canceled unknown authentication challenge with method %@", authenticationMethod);
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
}
}
Expand Down
20 changes: 20 additions & 0 deletions tests/Resources/ti.ui.webview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,4 +950,24 @@ describe('Titanium.UI.WebView', function () {
win.open();
});
});

it('url with clientCertChallenge', function (finish) {
const url = 'https://device.login.microsoftonline.com';

win = Ti.UI.createWindow();
const webView = Ti.UI.createWebView({
url: url
});

webView.addEventListener('error', function () {
finish(new Error('clientCertChallenge must be handled correctly.'));
});

webView.addEventListener('load', function () {
finish();
});

win.add(webView);
win.open();
});
});

1 comment on commit 2e8fa00

@joshualambert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad to see this landed finally in our code! Thanks for sticking with us @chauf and for contributing to the tidev project family.

Please sign in to comment.