Title: [291321] trunk/Source/WebKit
Revision
291321
Author
[email protected]
Date
2022-03-15 16:23:54 -0700 (Tue, 15 Mar 2022)

Log Message

[WebAuthn] Mock UI interactions whenever virtual authenticators are in use.
https://bugs.webkit.org/show_bug.cgi?id=237856
rdar://problem/90274854

Reviewed by Brent Fulgham.

Tested by wpt's webauthn tests.

* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp:
(WebKit::VirtualAuthenticatorManager::runPanel):
(WebKit::VirtualAuthenticatorManager::selectAssertionResponse):
(WebKit::VirtualAuthenticatorManager::decidePolicyForLocalAuthenticator):
* UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291320 => 291321)


--- trunk/Source/WebKit/ChangeLog	2022-03-15 23:16:02 UTC (rev 291320)
+++ trunk/Source/WebKit/ChangeLog	2022-03-15 23:23:54 UTC (rev 291321)
@@ -1,3 +1,20 @@
+2022-03-15  J Pascoe  <[email protected]>
+
+        [WebAuthn] Mock UI interactions whenever virtual authenticators are in use.
+        https://bugs.webkit.org/show_bug.cgi?id=237856
+        rdar://problem/90274854
+
+        Reviewed by Brent Fulgham.
+
+        Tested by wpt's webauthn tests.
+
+        * UIProcess/WebAuthentication/AuthenticatorManager.h:
+        * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp:
+        (WebKit::VirtualAuthenticatorManager::runPanel):
+        (WebKit::VirtualAuthenticatorManager::selectAssertionResponse):
+        (WebKit::VirtualAuthenticatorManager::decidePolicyForLocalAuthenticator):
+        * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h:
+
 2022-03-15  Chris Dumez  <[email protected]>
 
         Make it clearer in the loading logging when it is for the main frame or not

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h (291320 => 291321)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2022-03-15 23:16:02 UTC (rev 291320)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2022-03-15 23:23:54 UTC (rev 291321)
@@ -80,6 +80,12 @@
     void clearState();
     void invokePendingCompletionHandler(Respond&&);
 
+    void decidePolicyForLocalAuthenticator(CompletionHandler<void(LocalAuthenticatorPolicy)>&&);
+    TransportSet getTransports() const;
+    virtual void runPanel();
+    void selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&&, WebAuthenticationSource, CompletionHandler<void(WebCore::AuthenticatorAssertionResponse*)>&&);
+    void startDiscovery(const TransportSet&);
+
 private:
     enum class Mode {
         Compatible,
@@ -96,8 +102,6 @@
     void downgrade(Authenticator* id, Ref<Authenticator>&& downgradedAuthenticator) final;
     void authenticatorStatusUpdated(WebAuthenticationStatus) final;
     void requestPin(uint64_t retries, CompletionHandler<void(const WTF::String&)>&&) final;
-    void selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&&, WebAuthenticationSource, CompletionHandler<void(WebCore::AuthenticatorAssertionResponse*)>&&) final;
-    void decidePolicyForLocalAuthenticator(CompletionHandler<void(LocalAuthenticatorPolicy)>&&) final;
     void requestLAContextForUserVerification(CompletionHandler<void(LAContext *)>&&) final;
     void cancelRequest() final;
 
@@ -108,13 +112,10 @@
     virtual void filterTransports(TransportSet&) const;
     virtual void runPresenterInternal(const TransportSet&);
 
-    void startDiscovery(const TransportSet&);
     void initTimeOutTimer();
     void timeOutTimerFired();
-    void runPanel();
     void runPresenter();
     void restartDiscovery();
-    TransportSet getTransports() const;
     void dispatchPanelClientCall(Function<void(const API::WebAuthenticationPanel&)>&&) const;
 
     // Request: We only allow one request per time. A new request will cancel any pending ones.

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp (291320 => 291321)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp	2022-03-15 23:16:02 UTC (rev 291320)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp	2022-03-15 23:23:54 UTC (rev 291321)
@@ -63,6 +63,27 @@
     return VirtualService::createVirtual(transport, observer, configs);
 }
 
+void VirtualAuthenticatorManager::runPanel()
+{
+    auto transports = getTransports();
+    if (transports.isEmpty()) {
+        cancel();
+        return;
+    }
+
+    startDiscovery(transports);
+}
+
+void VirtualAuthenticatorManager::selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&& responses, WebAuthenticationSource source, CompletionHandler<void(WebCore::AuthenticatorAssertionResponse*)>&& completionHandler)
+{
+    completionHandler(responses[0].ptr());
+}
+
+void VirtualAuthenticatorManager::decidePolicyForLocalAuthenticator(CompletionHandler<void(LocalAuthenticatorPolicy)>&& completionHandler)
+{
+    completionHandler(LocalAuthenticatorPolicy::Allow);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(WEB_AUTHN)

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h (291320 => 291321)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h	2022-03-15 23:16:02 UTC (rev 291320)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h	2022-03-15 23:23:54 UTC (rev 291321)
@@ -40,6 +40,9 @@
     bool removeAuthenticator(const String& /*authenticatorId*/);
 
     bool isVirtual() const final { return true; }
+    void runPanel();
+    void selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&&, WebAuthenticationSource, CompletionHandler<void(WebCore::AuthenticatorAssertionResponse*)>&&);
+    void decidePolicyForLocalAuthenticator(CompletionHandler<void(LocalAuthenticatorPolicy)>&&);
 
 private:
     UniqueRef<AuthenticatorTransportService> createService(WebCore::AuthenticatorTransport, AuthenticatorTransportService::Observer&) const final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to