Convert CertificateInfo into Credential in UI Process instead of Networking Process
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2018 19:26:52 +0000 (19:26 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2018 19:26:52 +0000 (19:26 +0000)
commit66e634548178fbb716914fd25548eb091165cf65
tree057acaee031b014e02d092656cfa7b1b5efa6d09
parent5a458155e49fd731b8c02d449f36d05e10b469df
Convert CertificateInfo into Credential in UI Process instead of Networking Process
https://bugs.webkit.org/show_bug.cgi?id=185662
<rdar://problem/40275561>

Reviewed by Alex Christensen.

Source/WebKit:

Right now we convert CertificateInfo into Credential in the very last stage of client certificate authentication process
when it reaches Networking Process. This patch moves that conversion earlier in UI Process such that we don't have to
pass both Credential and CertificateInfo to Networking Process.

CertificateInfo is only used in macOS for C API specifically. WK2 includes macOS/iOS relies on NSURLCredential/WebCore::Credential
solely. WK2 has already exercised the ability of using WebCore::Credential to do client certficate authentication. This patch therefore
takes advantage of that. It converts CertficateInfo objects into Credential objects right after WebCredential is initialized, and then merge
any code paths that utilizes CertficateInfo into ones that uses WebCore::Credential.

Covered by existing tests.

* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::useCredentialForChallenge):
(WebKit::AuthenticationManager::useCredentialForSingleChallenge):
(WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): Deleted.
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/AuthenticationManager.messages.in:
* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::useCredential):
* UIProcess/Authentication/WebCredential.cpp:
(WebKit::WebCredential::WebCredential):
(WebKit::WebCredential::certificateInfo): Deleted.
* UIProcess/Authentication/WebCredential.h:
(WebKit::WebCredential::create):
* UIProcess/Authentication/mac/WebCredentialMac.mm: Renamed from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm.
(WebKit::leafCertificate):
(WebKit::chain):
(WebKit::WebCredential::WebCredential):
* WebKit.xcodeproj/project.pbxproj:

Source/WTF:

Remove marco HAVE_SEC_IDENTITY since it is no longer useful.

* wtf/Platform.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
Source/WebKit/Shared/Authentication/AuthenticationManager.h
Source/WebKit/Shared/Authentication/AuthenticationManager.messages.in
Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
Source/WebKit/UIProcess/Authentication/WebCredential.cpp
Source/WebKit/UIProcess/Authentication/WebCredential.h
Source/WebKit/UIProcess/Authentication/mac/WebCredentialMac.mm [moved from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm with 70% similarity]
Source/WebKit/WebKit.xcodeproj/project.pbxproj