Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8488c75
Starting on ssl pinning in core on iOS
theproducer Nov 3, 2025
e2dc25b
Move iOS SSL pinning into a core plugin
theproducer Nov 5, 2025
7cab068
Integrating SSLPinning with CapacitorHttp
theproducer Nov 5, 2025
12bdbf9
Starting on Android SSL Pinnin core plugin
theproducer Nov 6, 2025
05ab8c2
Integrating core SSL pinning with CapacitorHttp
theproducer Nov 6, 2025
1cdbedf
fmt
theproducer Nov 6, 2025
00c6d71
fmt
theproducer Nov 6, 2025
12fb55c
Merge branch 'main' into RMET-4519
theproducer Nov 6, 2025
2178078
Adding new handleWKWebViewURLAuthenticationChallenge plugin method
theproducer Nov 10, 2025
04c1c12
Removing SSL Plugin plugin from core
theproducer Nov 10, 2025
c9cb8b4
Making sure cert copy works with open sourced SSL pinning plugin
theproducer Nov 10, 2025
fcd32b5
Removing Android SSL Pinning plugin from core
theproducer Nov 10, 2025
d7a6753
fmt
theproducer Nov 10, 2025
024e289
fmt
theproducer Nov 10, 2025
95cb948
Merge branch 'main' into RMET-4519
theproducer Nov 10, 2025
ebacd63
Add documentation to handleWKWebViewURLAuthenticationChallenge
theproducer Nov 11, 2025
d545f26
more adjustments
theproducer Nov 11, 2025
1f0b878
Merge branch 'main' into RMET-4519
theproducer Nov 11, 2025
61e978d
Merge branch 'main' into RMET-4519
theproducer Nov 12, 2025
bf78dac
Sending the challenge and completionHandler to plugins
theproducer Nov 12, 2025
f10102d
Merge branch 'main' into RMET-4519
theproducer Nov 13, 2025
544c998
Removing no longer needed PluginURLAuthChallenge class
theproducer Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cli/src/tasks/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export async function copy(config: Config, platformName: string, inline = false)
}

let usesSSLPinning = false;
if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/ssl-pinning').length > 0) {
if (
allPlugins.filter(
(plugin) => plugin.id === '@ionic-enterprise/ssl-pinning' || plugin.id === '@capacitor/ssl-pinning',
).length > 0
) {
usesSSLPinning = true;
}

Expand Down
5 changes: 5 additions & 0 deletions ios/Capacitor/Capacitor/CAPPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
* Returning nil will defer to the default Capacitor policy
*/
- (NSNumber* _Nullable)shouldOverrideLoad:(WKNavigationAction* _Nonnull)navigationAction;
/**
* Allows plugins to hook into and respond to the WebView's URL authentication challenge.
* Returning false will defer to the default response of [.rejectProtectionSpace](https://developer.apple.com/documentation/Foundation/URLSession/AuthChallengeDisposition/rejectProtectionSpace).
*/
- (BOOL)handleWKWebViewURLAuthenticationChallenge:(NSURLAuthenticationChallenge* _Nonnull)challenge completionHandler:(void (^_Nonnull)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;

// Called after init if the plugin wants to do
// some loading so the plugin author doesn't
Expand Down
5 changes: 5 additions & 0 deletions ios/Capacitor/Capacitor/CAPPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,10 @@ - (NSNumber*)shouldOverrideLoad:(WKNavigationAction*)navigationAction {
return nil;
}

- (BOOL)handleWKWebViewURLAuthenticationChallenge:(NSURLAuthenticationChallenge* _Nonnull)challenge completionHandler:(void (^_Nonnull)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler {
return NO;
}


@end

20 changes: 20 additions & 0 deletions ios/Capacitor/Capacitor/WebViewDelegationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ open class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDelegat
webView.reload()
}

open func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping @MainActor (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
guard let bridge = bridge else {
completionHandler(.rejectProtectionSpace, nil)
return
}

for pluginObject in bridge.plugins {
let plugin = pluginObject.value
let selector = NSSelectorFromString("handleWKWebViewURLAuthenticationChallenge:completionHandler:")
if plugin.responds(to: selector) {
if plugin.handleWKWebViewURLAuthenticationChallenge(challenge, completionHandler: completionHandler) {
return
}
}
}

completionHandler(.rejectProtectionSpace, nil)
return
}

// MARK: - WKScriptMessageHandler

open func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
Expand Down