12020-01-10 Jiewen Tan <jiewen_tan@apple.com>
2
3 [WebAuthn] Implement SPI to tell UI clients to select assertion responses
4 https://bugs.webkit.org/show_bug.cgi?id=206112
5 <rdar://problem/58495733>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Covered by API tests.
10
11 This patch adds a new delegate method in _WKWebAuthenticationPanelDelegate to tell UI clients to
12 select an assertion response when multiple are returned from an authenticator. Here is the SPI:
13 @protocol _WKWebAuthenticationPanelDelegate <NSObject>
14 @optional
15 ...
16 - (void)panel:(_WKWebAuthenticationPanel *)panel selectAssertionResponses:(NSArray < _WKWebAuthenticationAssertionResponse *> *)responses completionHandler:(void (^)(_WKWebAuthenticationAssertionResponse *))completionHandler;
17 ...
18 @end
19
20 A new interface is introduced to represent an authenticator assertion response:
21 @interface _WKWebAuthenticationAssertionResponse : NSObject
22 @property (nonatomic, readonly, copy) NSString *name;
23 @property (nonatomic, readonly, copy) NSString *displayName;
24 @property (nonatomic, readonly, copy) NSData *userHandle;
25 @end
26 Only members that can assist users to make a decision are exposed to UI clients.
27
28 * Shared/API/APIObject.h:
29 * Shared/Cocoa/APIObject.mm:
30 (API::Object::newObject):
31 * Sources.txt:
32 * SourcesCocoa.txt:
33 * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
34 (API::WebAuthenticationAssertionResponse::create):
35 (API::WebAuthenticationAssertionResponse::WebAuthenticationAssertionResponse):
36 * UIProcess/API/APIWebAuthenticationAssertionResponse.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
37 * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
38 * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
39 (-[_WKWebAuthenticationAssertionResponse dealloc]):
40 (-[_WKWebAuthenticationAssertionResponse name]):
41 (-[_WKWebAuthenticationAssertionResponse displayName]):
42 (-[_WKWebAuthenticationAssertionResponse userHandle]):
43 (-[_WKWebAuthenticationAssertionResponse _apiObject]):
44 * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
45 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
46 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
47 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
48 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
49 (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
50 (WebKit::WebAuthenticationPanelClient::selectAssertionResponses const):
51 * WebKit.xcodeproj/project.pbxproj:
52