iOS - Load client certificate from local storage
This commit is contained in:
parent
4d580e849d
commit
568079359d
|
@ -8,6 +8,9 @@
|
||||||
- Fixed iOS 14.0 crash when calling `callAsyncJavaScript` method
|
- Fixed iOS 14.0 crash when calling `callAsyncJavaScript` method
|
||||||
- Merged "Android fix leaking MethodChannel through anonymous class" [#1201](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1201) (thanks to [emakar](https://github.com/emakar))
|
- Merged "Android fix leaking MethodChannel through anonymous class" [#1201](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1201) (thanks to [emakar](https://github.com/emakar))
|
||||||
- Merged "Fix RangeError: Maximum call stack size exceeded" [#1208](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1208) (thanks to [liasica](https://github.com/liasica))
|
- Merged "Fix RangeError: Maximum call stack size exceeded" [#1208](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1208) (thanks to [liasica](https://github.com/liasica))
|
||||||
|
- Merged "fix: try to open with Chrome if default browser app does not support custom tabs" [#1233](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1233) (thanks to [addie9000](https://github.com/addie9000))
|
||||||
|
- Merged "fix: Prevent Android java.lang.NullPointerException in InAppWebViewCl…" [#1237](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1237) (thanks to [kamilpowalowski](https://github.com/kamilpowalowski))
|
||||||
|
- Merged "Android - Load client certificate from local storage" [#1241](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1241) (thanks to [akioyamamoto1977](https://github.com/akioyamamoto1977))
|
||||||
|
|
||||||
## 5.4.4+3
|
## 5.4.4+3
|
||||||
|
|
||||||
|
|
|
@ -1770,21 +1770,19 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
let certificatePath = response["certificatePath"] as! String;
|
let certificatePath = response["certificatePath"] as! String;
|
||||||
let certificatePassword = response["certificatePassword"] as? String ?? "";
|
let certificatePassword = response["certificatePassword"] as? String ?? "";
|
||||||
|
|
||||||
|
var path: String = certificatePath
|
||||||
do {
|
do {
|
||||||
let path = try Util.getAbsPathAsset(assetFilePath: certificatePath)
|
path = try Util.getAbsPathAsset(assetFilePath: certificatePath)
|
||||||
let PKCS12Data = NSData(contentsOfFile: path)!
|
} catch {}
|
||||||
|
|
||||||
if let identityAndTrust: IdentityAndTrust = self.extractIdentity(PKCS12Data: PKCS12Data, password: certificatePassword) {
|
if let PKCS12Data = NSData(contentsOfFile: path),
|
||||||
let urlCredential: URLCredential = URLCredential(
|
let identityAndTrust: IdentityAndTrust = self.extractIdentity(PKCS12Data: PKCS12Data, password: certificatePassword) {
|
||||||
identity: identityAndTrust.identityRef,
|
let urlCredential: URLCredential = URLCredential(
|
||||||
certificates: identityAndTrust.certArray as? [AnyObject],
|
identity: identityAndTrust.identityRef,
|
||||||
persistence: URLCredential.Persistence.forSession);
|
certificates: identityAndTrust.certArray as? [AnyObject],
|
||||||
completionHandler(.useCredential, urlCredential)
|
persistence: URLCredential.Persistence.forSession);
|
||||||
} else {
|
completionHandler(.useCredential, urlCredential)
|
||||||
completionHandler(.performDefaultHandling, nil)
|
} else {
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
print(error.localizedDescription)
|
|
||||||
completionHandler(.performDefaultHandling, nil)
|
completionHandler(.performDefaultHandling, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue