12020-03-03 Jiewen Tan <jiewen_tan@apple.com>
2
3 [WebAuthn] Implement -[_WKWebAuthenticationPanelDelegate panel:decidePolicyForLocalAuthenticatorWithCompletionHandler:] SPI
4 https://bugs.webkit.org/show_bug.cgi?id=208533
5 <rdar://problem/60010184>
6
7 Reviewed by NOBODY (OOPS!).
8
9 This patch implements the above SPI to replace -[_WKWebAuthenticationPanelDelegate panel:verifyUserWithAccessControl:completionHandler:].
10 The original SPI is designed on the premise that Safari is going to highly customize the LocalAuthentication UI, and that is not happening
11 anymore. Therefore, WebKit takes back the invocation of LocalAuthentication and offer a new SPI to tell clients when WebKit is about to
12 show LocalAuthentication UI. Clients then have the trigger to pull at their pleasure.
13
14 This patch implements all plumbings to replace the SPI. Besides that, this patch also:
15 1) enhances the LocalConnection::verifyUser with a slightly customized LocalAuthentication dialog;
16 2) adds the SPI used above into the SPI header;
17 3) makes _WKWebAuthenticationPanelDelegate.transports as a NSSet instead of a NSArray;
18 4) lets LocalService::isAvailable return false if Apple attestation is not available.
19
20 * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
21 * UIProcess/API/APIWebAuthenticationPanelClient.h:
22 (API::WebAuthenticationPanelClient::decidePolicyForLocalAuthenticator const):
23 (API::WebAuthenticationPanelClient::verifyUser const): Deleted.
24 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
25 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
26 (-[_WKWebAuthenticationPanel transports]):
27 * UIProcess/WebAuthentication/Authenticator.h:
28 * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
29 (WebKit::AuthenticatorManager::decidePolicyForLocalAuthenticator):
30 (WebKit::AuthenticatorManager::verifyUser): Deleted.
31 * UIProcess/WebAuthentication/AuthenticatorManager.h:
32 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
33 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
34 (WebKit::LocalAuthenticator::makeCredential):
35 (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
36 (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
37 (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
38 (WebKit::LocalAuthenticator::getAssertion):
39 (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
40 (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
41 (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented): Deleted.
42 (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented): Deleted.
43 * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
44 * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
45 (WebKit::LocalConnection::verifyUser const):
46 (WebKit::LocalConnection::isUnlocked const): Deleted.
47 * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
48 (WebKit::LocalService::isAvailable):
49 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
50 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
51 (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
52 (WebKit::localAuthenticatorPolicy):
53 (WebKit::WebAuthenticationPanelClient::decidePolicyForLocalAuthenticator const):
54 (WebKit::WebAuthenticationPanelClient::verifyUser const): Deleted.
55 * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
56 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
57 (WebKit::MockLocalConnection::verifyUser const):
58 (WebKit::MockLocalConnection::isUnlocked const): Deleted.
59 * UIProcess/WebAuthentication/WebAuthenticationFlags.h:
60