|
|
@@ -10,4 +10,21 @@ import Flutter
|
|
|
GeneratedPluginRegistrant.register(with: self)
|
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
|
}
|
|
|
+ func connectionShouldUseCredentialStorage(_ connection: NSURLConnection) -> Bool {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ func connection(_ connection: NSURLConnection, willSendRequestFor challenge: URLAuthenticationChallenge) {
|
|
|
+ if let previous = challenge.previousFailureCount as? ssize_t {
|
|
|
+ print(String(format: "didReceiveAuthenticationChallenge %@ %zd", challenge.protectionSpace.authenticationMethod, previous))
|
|
|
+ }
|
|
|
+ if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
|
|
|
+ challenge.sender?.use(URLCredential(for: challenge.protectionSpace.serverTrust), for: challenge)
|
|
|
+ challenge.sender?.continueWithoutCredential(for: challenge)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func connection(_ connection: NSURLConnection, canAuthenticateAgainstProtectionSpace protectionSpace: URLProtectionSpace) -> Bool {
|
|
|
+ return protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust
|
|
|
+ }
|
|
|
}
|