소스 검색

App crashes when server asks for client TLS certificate #520

Marino Faggiana 7 년 전
부모
커밋
a746d8f16c
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      iOSClient/Library/SwiftWebVC/SwiftWebVC.swift

+ 2 - 4
iOSClient/Library/SwiftWebVC/SwiftWebVC.swift

@@ -365,12 +365,10 @@ extension SwiftWebVC: WKNavigationDelegate {
     
     public func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
         
-        if challenge.previousFailureCount > 0 {
-            completionHandler(Foundation.URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge, nil)
-        } else if let serverTrust = challenge.protectionSpace.serverTrust {
+        if let serverTrust = challenge.protectionSpace.serverTrust {
             completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
         } else {
-            print("unknown state. error: \(String(describing: challenge.error))")
+            completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil);
         }
     }