Title: [270616] trunk
Revision
270616
Author
jiewen_...@apple.com
Date
2020-12-10 00:41:43 -0800 (Thu, 10 Dec 2020)

Log Message

[WebAuthn] Adopt new UI for the Security Key makeCredential flow
https://bugs.webkit.org/show_bug.cgi?id=219708
<rdar://problem/72154735>

Reviewed by Brent Fulgham.

Source/WebKit:

This patch adopts the new AuthenticationServices' UI. The idea is to use AuthenticatorPresenterCoordinator
as the middle layer to connect to the new UI while keeping the existing interfaces the same in the AuthenticatorManager
to handle the interactions between UI and authenticators.

Covered by manual tests.

* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Added.
SPI for the new UI.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Scripts/process-entitlements.sh:
Added new sandbox rules for Remote SpringBoard services which are used by the new UI.

* SourcesCocoa.txt:
Paperwork.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::handleRequest):
(WebKit::AuthenticatorManager::cancel):
(WebKit::AuthenticatorManager::enableModernWebAuthentication):
(WebKit::AuthenticatorManager::clearState):
(WebKit::AuthenticatorManager::serviceStatusUpdated):
(WebKit::AuthenticatorManager::authenticatorStatusUpdated):
(WebKit::AuthenticatorManager::requestPin):
(WebKit::AuthenticatorManager::selectAssertionResponse):
(WebKit::AuthenticatorManager::startDiscovery):
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::runPresenter):
(WebKit::AuthenticatorManager::invokePendingCompletionHandler):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
Teached AuthenticatorManager to use the new UI's presenter when it is available. Otherwise, it falls back to the old UI.

* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: Added.
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Added.
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: Added.
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: Added.
(WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator):
(WebKit::AuthenticatorPresenterCoordinator::updatePresenter):
(WebKit::AuthenticatorPresenterCoordinator::requestPin):
(WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse):
(WebKit::AuthenticatorPresenterCoordinator::dimissPresenter):
* UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: Added.
* UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: Added.
(-[WKASCAuthorizationPresenterDelegate initWithCoordinator:]):
(-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]):
(-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]):
Introduced the AuthenticatorPresenterCoordinator to handle the new UI.

* WebAuthnProcess/WebAuthnProcess.cpp:
(WebKit::WebAuthnProcess::WebAuthnProcess):
(WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration):
Teached WebAuthnProcess to inform AuthenticatorManager about its existence.

* WebKit.xcodeproj/project.pbxproj:
Paperwork.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(TestWebKitAPI::TEST):
Adjusted to the new behavior.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (270615 => 270616)


--- trunk/Source/WebKit/ChangeLog	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/ChangeLog	2020-12-10 08:41:43 UTC (rev 270616)
@@ -1,3 +1,67 @@
+2020-12-10  Jiewen Tan  <jiewen_...@apple.com>
+
+        [WebAuthn] Adopt new UI for the Security Key makeCredential flow
+        https://bugs.webkit.org/show_bug.cgi?id=219708
+        <rdar://problem/72154735>
+
+        Reviewed by Brent Fulgham.
+
+        This patch adopts the new AuthenticationServices' UI. The idea is to use AuthenticatorPresenterCoordinator
+        as the middle layer to connect to the new UI while keeping the existing interfaces the same in the AuthenticatorManager
+        to handle the interactions between UI and authenticators.
+
+        Covered by manual tests.
+
+        * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Added.
+        SPI for the new UI.
+
+        * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
+        * Scripts/process-entitlements.sh:
+        Added new sandbox rules for Remote SpringBoard services which are used by the new UI.
+
+        * SourcesCocoa.txt:
+        Paperwork.
+
+        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+        (WebKit::AuthenticatorManager::handleRequest):
+        (WebKit::AuthenticatorManager::cancel):
+        (WebKit::AuthenticatorManager::enableModernWebAuthentication):
+        (WebKit::AuthenticatorManager::clearState):
+        (WebKit::AuthenticatorManager::serviceStatusUpdated):
+        (WebKit::AuthenticatorManager::authenticatorStatusUpdated):
+        (WebKit::AuthenticatorManager::requestPin):
+        (WebKit::AuthenticatorManager::selectAssertionResponse):
+        (WebKit::AuthenticatorManager::startDiscovery):
+        (WebKit::AuthenticatorManager::runPanel):
+        (WebKit::AuthenticatorManager::runPresenter):
+        (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
+        * UIProcess/WebAuthentication/AuthenticatorManager.h:
+        Teached AuthenticatorManager to use the new UI's presenter when it is available. Otherwise, it falls back to the old UI.
+
+        * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: Added.
+        * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Added.
+        * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: Added.
+        * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: Added.
+        (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator):
+        (WebKit::AuthenticatorPresenterCoordinator::updatePresenter):
+        (WebKit::AuthenticatorPresenterCoordinator::requestPin):
+        (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse):
+        (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter):
+        * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: Added.
+        * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: Added.
+        (-[WKASCAuthorizationPresenterDelegate initWithCoordinator:]):
+        (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]):
+        (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]):
+        Introduced the AuthenticatorPresenterCoordinator to handle the new UI.
+
+        * WebAuthnProcess/WebAuthnProcess.cpp:
+        (WebKit::WebAuthnProcess::WebAuthnProcess):
+        (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration):
+        Teached WebAuthnProcess to inform AuthenticatorManager about its existence.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        Paperwork.
+
 2020-12-09  Per Arne Vollan  <pvol...@apple.com>
 
         [macOS] Remove com.apple.PowerManagement.control from WebContent sandbox

Added: trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h (0 => 270616)


--- trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h	                        (rev 0)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(IOS)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <AuthenticationServicesCore/ASCAuthorizationPresentationContext.h>
+#import <AuthenticationServicesCore/ASCAuthorizationPresenter.h>
+#import <AuthenticationServicesCore/ASCPlatformPublicKeyCredentialLoginChoice.h>
+#import <AuthenticationServicesCore/ASCSecurityKeyPublicKeyCredentialLoginChoice.h>
+
+#else
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class LAContext;
+
+@protocol ASCLoginChoiceProtocol;
+@protocol ASCCredentialProtocol;
+
+@protocol ASCAuthorizationPresenterHostProtocol <NSObject>
+
+- (void)authorizationRequestInitiatedWithLoginChoice:(id <ASCLoginChoiceProtocol>)loginChoice authenticatedContext:(nullable LAContext *)context completionHandler:(void (^)(id <ASCCredentialProtocol> credential, NSError *error))completionHandler;
+
+- (void)authorizationRequestFinishedWithCredential:(nullable id<ASCCredentialProtocol>)credential error:(nullable NSError *)error completionHandler:(void (^)(void))completionHandler;
+
+- (void)validateUserEnteredPIN:(NSString *)pin completionHandler:(void (^)(id <ASCCredentialProtocol> credential, NSError *error))completionHandler;
+
+@end
+
+@class ASCAuthorizationPresentationContext;
+@class ASCAuthorizationPresenter;
+
+@protocol ASCAuthorizationPresenterDelegate <NSObject>
+
+- (void)authorizationPresenter:(ASCAuthorizationPresenter *)presenter credentialRequestedForLoginChoice:(id <ASCLoginChoiceProtocol>)loginChoice authenticatedContext:(nullable LAContext *)context completionHandler:(void (^)(id <ASCCredentialProtocol> _Nullable credential, NSError * _Nullable error))completionHandler;
+
+- (void)authorizationPresenter:(ASCAuthorizationPresenter *)presenter validateUserEnteredPIN:(NSString *)pin completionHandler:(void (^)(id <ASCCredentialProtocol> credential, NSError *error))completionHandler;
+
+@end
+
+@interface ASCAuthorizationPresenter : NSObject <ASCAuthorizationPresenterHostProtocol>
+
+- (void)presentAuthorizationWithContext:(ASCAuthorizationPresentationContext *)context completionHandler:(void (^)(id<ASCCredentialProtocol> _Nullable, NSError * _Nullable))completionHandler;
+
+@property (nonatomic, weak) id <ASCAuthorizationPresenterDelegate> delegate;
+
+@end
+
+@class ASCCredentialRequestContext;
+
+extern NSString * const ASCAuthorizationPresentationContextDataKey;
+
+@interface ASCAuthorizationPresentationContext : NSObject <NSSecureCoding>
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+- (instancetype)initWithRequestContext:(nullable ASCCredentialRequestContext *)requestContext appIdentifier:(nullable NSString *)appIdentifier;
+
+- (void)addLoginChoice:(id<ASCLoginChoiceProtocol>)loginChoice;
+
+@property (nonatomic, readonly, copy) NSString *appIdentifier;
+@property (nonatomic, readonly, copy) NSArray<id<ASCLoginChoiceProtocol>> *loginChoices;
+@property (nonatomic, nullable, copy) NSString *relyingPartyIdentifier;
+
+@property (nonatomic, copy) NSString *proxiedAppName;
+@property (nonatomic, copy) NSArray<NSString *> *proxiedAssociatedDomains;
+@property (nonatomic, copy) NSData *proxiedIconData;
+@property (nonatomic, copy) NSNumber *proxiedIconScale;
+
+@end
+
+@protocol ASCLoginChoiceProtocol <NSObject, NSSecureCoding>
+
+@end
+
+@interface ASCSecurityKeyPublicKeyCredentialLoginChoice : NSObject <ASCLoginChoiceProtocol>
+
+- (instancetype)initRegistrationChoice;
+- (instancetype)initWithName:(NSString *)name displayName:(NSString *)displayName userHandle:(NSData *)userHandle;
+
+@property (nonatomic, readonly, copy) NSString *name;
+@property (nonatomic, readonly, copy) NSString *displayName;
+@property (nonatomic, readonly, copy) NSData *userHandle;
+@property (nonatomic, readonly) BOOL isRegistrationRequest;
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+@interface ASCPlatformPublicKeyCredentialLoginChoice : NSObject <ASCLoginChoiceProtocol>
+
+- (instancetype)initRegistrationChoice;
+- (instancetype)initWithName:(NSString *)name displayName:(NSString *)displayName userHandle:(NSData *)userHandle;
+
+@property (nonatomic, readonly, copy) NSString *name;
+@property (nonatomic, readonly, copy) NSString *displayName;
+@property (nonatomic, readonly, copy) NSData *userHandle;
+@property (nonatomic, readonly) BOOL isRegistrationRequest;
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // USE(APPLE_INTERNAL_SDK)
+
+#endif // PLATFORM(IOS)

Modified: trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb (270615 => 270616)


--- trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb	2020-12-10 08:41:43 UTC (rev 270616)
@@ -641,3 +641,7 @@
 ;; Allow accesses to NFC
 (allow mach-lookup
     (global-name "com.apple.nfcd.hwmanager"))
+
+;; Allow accesses to the Springboard view services.
+(allow mach-lookup
+    (global-name "com.apple.frontboard.systemappservices"))

Modified: trunk/Source/WebKit/Scripts/process-entitlements.sh (270615 => 270616)


--- trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-12-10 08:41:43 UTC (rev 270616)
@@ -260,6 +260,9 @@
     plistbuddy Add :com.apple.appattest.spi bool YES
     plistbuddy Add :com.apple.mobileactivationd.spi bool YES
 
+    plistbuddy Add :com.apple.springboard.remote-alert bool YES
+    plistbuddy Add :com.apple.frontboard.launchapplications bool YES
+
     plistbuddy Add :seatbelt-profiles array
     plistbuddy Add :seatbelt-profiles:0 string com.apple.WebKit.WebAuthn
 }

Modified: trunk/Source/WebKit/SourcesCocoa.txt (270615 => 270616)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-12-10 08:41:43 UTC (rev 270616)
@@ -539,6 +539,8 @@
 UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
 
 UIProcess/WebAuthentication/Cocoa/AppAttestInternalSoftLink.mm @no-unify
+UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm @no-unify
+UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm
 UIProcess/WebAuthentication/Cocoa/HidConnection.mm
 UIProcess/WebAuthentication/Cocoa/HidService.mm
 UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.mm @no-unify
@@ -548,6 +550,7 @@
 UIProcess/WebAuthentication/Cocoa/NearFieldSoftLink.mm @no-unify
 UIProcess/WebAuthentication/Cocoa/NfcConnection.mm
 UIProcess/WebAuthentication/Cocoa/NfcService.mm
+UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm
 UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm
 UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm
 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (270615 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2020-12-10 08:41:43 UTC (rev 270616)
@@ -31,6 +31,7 @@
 #include "APIUIClient.h"
 #include "APIWebAuthenticationPanel.h"
 #include "APIWebAuthenticationPanelClient.h"
+#include "AuthenticatorPresenterCoordinator.h"
 #include "LocalService.h"
 #include "NfcService.h"
 #include "WebPageProxy.h"
@@ -164,13 +165,14 @@
     // 2. Ask clients to show appropriate UI if any and then start the request.
     initTimeOutTimer();
 
-    // FIXME<rdar://problem/70822834>: The WebPageProxy is used to determine whether or not we are in the UIProcess.
+    // FIXME<rdar://problem/70822834>: The m_isWebAuthenticationModernEnabled is used to determine
+    // whether or not we are in the UIProcess.
     // If so, continue to the old route. Otherwise, use the modern WebAuthn process way.
-    if (m_pendingRequestData.page) {
+    if (!m_isWebAuthenticationModernEnabled) {
         runPanel();
         return;
     }
-    startDiscovery(getTransports());
+    runPresenter();
 }
 
 void AuthenticatorManager::cancelRequest(const PageIdentifier& pageID, const Optional<FrameIdentifier>& frameID)
@@ -197,6 +199,19 @@
     cancelRequest();
 }
 
+void AuthenticatorManager::cancel()
+{
+    RELEASE_ASSERT(RunLoop::isMain());
+    if (!m_pendingCompletionHandler)
+        return;
+    cancelRequest();
+}
+
+void AuthenticatorManager::enableModernWebAuthentication()
+{
+    m_isWebAuthenticationModernEnabled = true;
+}
+
 void AuthenticatorManager::clearStateAsync()
 {
     RunLoop::main().dispatch([weakThis = makeWeakPtr(*this)] {
@@ -213,6 +228,7 @@
     m_authenticators.clear();
     m_services.clear();
     m_pendingRequestData = { };
+    m_presenter = nullptr;
 }
 
 void AuthenticatorManager::authenticatorAdded(Ref<Authenticator>&& authenticator)
@@ -226,6 +242,12 @@
 
 void AuthenticatorManager::serviceStatusUpdated(WebAuthenticationStatus status)
 {
+    // This is for the new UI.
+    if (m_presenter) {
+        m_presenter->updatePresenter(status);
+        return;
+    }
+
     dispatchPanelClientCall([status] (const API::WebAuthenticationPanel& panel) {
         panel.client().updatePanel(status);
     });
@@ -268,6 +290,12 @@
     // an error. We don't really care what kind of error it really is.
     m_pendingRequestData.cachedPin = String();
 
+    // This is for the new UI.
+    if (m_presenter) {
+        m_presenter->updatePresenter(status);
+        return;
+    }
+
     dispatchPanelClientCall([status] (const API::WebAuthenticationPanel& panel) {
         panel.client().updatePanel(status);
     });
@@ -292,6 +320,12 @@
         completionHandler(pin);
     };
 
+    // This is for the new UI.
+    if (m_presenter) {
+        m_presenter->requestPin(retries, WTFMove(callback));
+        return;
+    }
+
     dispatchPanelClientCall([retries, callback = WTFMove(callback)] (const API::WebAuthenticationPanel& panel) mutable {
         panel.client().requestPin(retries, WTFMove(callback));
     });
@@ -299,6 +333,12 @@
 
 void AuthenticatorManager::selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&& responses, WebAuthenticationSource source, CompletionHandler<void(AuthenticatorAssertionResponse*)>&& completionHandler)
 {
+    // This is for the new UI.
+    if (m_presenter) {
+        m_presenter->selectAssertionResponse(WTFMove(responses), source, WTFMove(completionHandler));
+        return;
+    }
+
     dispatchPanelClientCall([responses = WTFMove(responses), source, completionHandler = WTFMove(completionHandler)] (const API::WebAuthenticationPanel& panel) mutable {
         panel.client().selectAssertionResponse(WTFMove(responses), source, WTFMove(completionHandler));
     });
@@ -340,9 +380,6 @@
     ASSERT(RunLoop::isMain());
     ASSERT(m_services.isEmpty() && transports.size() <= maxTransportNumber);
     for (auto& transport : transports) {
-        // Only allow USB authenticators when clients don't have dedicated UI.
-        if (transport != AuthenticatorTransport::Usb && (m_pendingRequestData.panelResult == WebAuthenticationPanelResult::Unavailable))
-            continue;
         auto service = createService(transport, *this);
         service->startDiscovery();
         m_services.append(WTFMove(service));
@@ -389,16 +426,31 @@
             || (result == WebAuthenticationPanelResult::DidNotPresent)
             || (weakPanel.get() != m_pendingRequestData.panel.get()))
             return;
-        m_pendingRequestData.panelResult = result;
         startDiscovery(transports);
     });
 }
 
+void AuthenticatorManager::runPresenter()
+{
+    // Get available transports and start discovering authenticators on them.
+    auto& options = m_pendingRequestData.options;
+    auto transports = getTransports();
+    startDiscovery(transports);
+
+    m_presenter = makeUnique<AuthenticatorPresenterCoordinator>(*this, getRpId(options), transports, getClientDataType(options));
+}
+
 void AuthenticatorManager::invokePendingCompletionHandler(Respond&& respond)
 {
-    dispatchPanelClientCall([result = WTF::holds_alternative<Ref<AuthenticatorResponse>>(respond) ? WebAuthenticationResult::Succeeded : WebAuthenticationResult::Failed] (const API::WebAuthenticationPanel& panel) {
-        panel.client().dismissPanel(result);
-    });
+    // This is for the new UI.
+    if (m_presenter)
+        m_presenter->dimissPresenter();
+    else {
+        dispatchPanelClientCall([result = WTF::holds_alternative<Ref<AuthenticatorResponse>>(respond) ? WebAuthenticationResult::Succeeded : WebAuthenticationResult::Failed] (const API::WebAuthenticationPanel& panel) {
+            panel.client().dismissPanel(result);
+        });
+    }
+
     m_pendingCompletionHandler(WTFMove(respond));
 }
 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h (270615 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2020-12-10 08:41:43 UTC (rev 270616)
@@ -28,6 +28,7 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "Authenticator.h"
+#include "AuthenticatorPresenterCoordinator.h"
 #include "AuthenticatorTransportService.h"
 #include "WebAuthenticationRequestData.h"
 #include <WebCore/AuthenticatorResponse.h>
@@ -63,9 +64,12 @@
     void handleRequest(WebAuthenticationRequestData&&, Callback&&);
     void cancelRequest(const WebCore::PageIdentifier&, const Optional<WebCore::FrameIdentifier>&); // Called from WebPageProxy/WebProcessProxy.
     void cancelRequest(const API::WebAuthenticationPanel&); // Called from panel clients.
+    void cancel(); // Called from the presenter.
 
     virtual bool isMock() const { return false; }
 
+    void enableModernWebAuthentication();
+
 protected:
     RunLoop::Timer<AuthenticatorManager>& requestTimeOutTimer() { return m_requestTimeOutTimer; }
     void clearStateAsync(); // To void cyclic dependence.
@@ -96,6 +100,7 @@
     void initTimeOutTimer();
     void timeOutTimerFired();
     void runPanel();
+    void runPresenter();
     void restartDiscovery();
     TransportSet getTransports() const;
     void dispatchPanelClientCall(Function<void(const API::WebAuthenticationPanel&)>&&) const;
@@ -104,9 +109,12 @@
     WebAuthenticationRequestData m_pendingRequestData;
     Callback m_pendingCompletionHandler; // Should not be invoked directly, use invokePendingCompletionHandler.
     RunLoop::Timer<AuthenticatorManager> m_requestTimeOutTimer;
+    std::unique_ptr<AuthenticatorPresenterCoordinator> m_presenter;
 
     Vector<UniqueRef<AuthenticatorTransportService>> m_services;
     HashSet<Ref<Authenticator>> m_authenticators;
+
+    bool m_isWebAuthenticationModernEnabled { false };
 };
 
 } // namespace WebKit

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import "AuthenticationServicesCoreSPI.h"
+#import <wtf/SoftLinking.h>
+
+#if PLATFORM(IOS)
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebKit, AuthenticationServicesCore);
+
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCAuthorizationPresenter);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCAuthorizationPresentationContext);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCPlatformPublicKeyCredentialLoginChoice);
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, ASCSecurityKeyPublicKeyCredentialLoginChoice);
+
+#endif // PLATFORM(IOS)

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "AuthenticationServicesCoreSPI.h"
+#import <wtf/SoftLinking.h>
+
+#if PLATFORM(IOS)
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(WebKit, AuthenticationServicesCore);
+
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAuthorizationPresenter);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCAuthorizationPresentationContext);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCPlatformPublicKeyCredentialLoginChoice);
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, AuthenticationServicesCore, ASCSecurityKeyPublicKeyCredentialLoginChoice);
+
+#endif // PLATFORM(IOS)

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN)
+
+#include "WebAuthenticationFlags.h"
+#include <WebCore/AuthenticatorTransport.h>
+#include <WebCore/WebAuthenticationConstants.h>
+#include <wtf/Forward.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/WeakPtr.h>
+
+OBJC_CLASS ASCAuthorizationPresenter;
+OBJC_CLASS WKASCAuthorizationPresenterDelegate;
+
+namespace WebCore {
+class AuthenticatorAssertionResponse;
+}
+
+namespace WebKit {
+
+class AuthenticatorManager;
+
+class AuthenticatorPresenterCoordinator : public CanMakeWeakPtr<AuthenticatorPresenterCoordinator> {
+    WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(AuthenticatorPresenterCoordinator);
+public:
+    using TransportSet = HashSet<WebCore::AuthenticatorTransport, WTF::IntHash<WebCore::AuthenticatorTransport>, WTF::StrongEnumHashTraits<WebCore::AuthenticatorTransport>>;
+
+    AuthenticatorPresenterCoordinator(const AuthenticatorManager&, const String& rpId, const TransportSet&, WebCore::ClientDataType);
+
+    void updatePresenter(WebAuthenticationStatus);
+    void requestPin(uint64_t retries, CompletionHandler<void(const String&)>&&);
+    void selectAssertionResponse(Vector<Ref<WebCore::AuthenticatorAssertionResponse>>&&, WebAuthenticationSource, CompletionHandler<void(WebCore::AuthenticatorAssertionResponse*)>&&);
+    void dimissPresenter();
+
+private:
+    WeakPtr<AuthenticatorManager> m_manager;
+    RetainPtr<ASCAuthorizationPresenter> m_presenter;
+    RetainPtr<WKASCAuthorizationPresenterDelegate> m_presenterDelegate;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN)

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AuthenticatorPresenterCoordinator.h"
+
+#if ENABLE(WEB_AUTHN)
+
+#import "AuthenticatorManager.h"
+#import "WKASCAuthorizationPresenterDelegate.h"
+#import <WebCore/NotImplemented.h>
+#import <wtf/BlockPtr.h>
+
+#import "AuthenticationServicesCoreSoftLink.h"
+
+namespace WebKit {
+using namespace WebCore;
+
+AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator(const AuthenticatorManager& manager, const String& rpId, const TransportSet& transports, ClientDataType type)
+    : m_manager(makeWeakPtr(manager))
+{
+#if PLATFORM(IOS)
+    auto presentationContext = adoptNS([allocASCAuthorizationPresentationContextInstance() initWithRequestContext:nullptr appIdentifier:nullptr]);
+    [presentationContext setRelyingPartyIdentifier: rpId];
+
+    switch (type) {
+    case ClientDataType::Create:
+        if (transports.contains(AuthenticatorTransport::Internal))
+            [presentationContext addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()];
+        if (transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc))
+            [presentationContext addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()];
+        break;
+    case ClientDataType::Get:
+        // FIXME(219710): Adopt new UI for the Platform Authenticator getAssertion flow.
+        // FIXME(219711): Adopt new UI for the Security Key getAssertion flow.
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    m_presenterDelegate = [[WKASCAuthorizationPresenterDelegate alloc] initWithCoordinator:*this];
+    m_presenter = [allocASCAuthorizationPresenterInstance() init];
+    [m_presenter setDelegate:m_presenterDelegate.get()];
+
+    auto completionHandler = makeBlockPtr([manager = m_manager] (id<ASCCredentialProtocol>, NSError *error) mutable {
+        if (!error)
+            return;
+
+        LOG_ERROR("Couldn't complete the authenticator presentation context: %@", error);
+        // This block can be executed in another thread.
+        RunLoop::main().dispatch([manager] () mutable {
+            if (manager)
+                manager->cancel();
+        });
+    });
+    [m_presenter presentAuthorizationWithContext:presentationContext.get() completionHandler:completionHandler.get()];
+#else
+    notImplemented();
+#endif // PLATFORM(IOS)
+}
+
+void AuthenticatorPresenterCoordinator::updatePresenter(WebAuthenticationStatus)
+{
+    // FIXME(219713): Adopt new UI for the update flow.
+}
+
+void AuthenticatorPresenterCoordinator::requestPin(uint64_t, CompletionHandler<void(const String&)>&&)
+{
+    // FIXME(219712): Adopt new UI for the Client PIN flow.
+}
+
+void AuthenticatorPresenterCoordinator::selectAssertionResponse(Vector<Ref<AuthenticatorAssertionResponse>>&&, WebAuthenticationSource, CompletionHandler<void(AuthenticatorAssertionResponse*)>&&)
+{
+    // FIXME(219710): Adopt new UI for the Platform Authenticator getAssertion flow.
+    // FIXME(219711): Adopt new UI for the Security Key getAssertion flow.
+}
+
+void AuthenticatorPresenterCoordinator::dimissPresenter()
+{
+    // FIXME(219716): Adopt new UI for the dismiss flow.
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN)

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(IOS)
+
+#import "AuthenticationServicesCoreSPI.h"
+
+namespace WebKit {
+class AuthenticatorPresenterCoordinator;
+}
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface WKASCAuthorizationPresenterDelegate : NSObject <ASCAuthorizationPresenterDelegate>
+
+- (instancetype)initWithCoordinator:(WebKit::AuthenticatorPresenterCoordinator&)coordinator;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(IOS)

Added: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm (0 => 270616)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm	2020-12-10 08:41:43 UTC (rev 270616)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKASCAuthorizationPresenterDelegate.h"
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(IOS)
+
+#import "AuthenticatorPresenterCoordinator.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@implementation WKASCAuthorizationPresenterDelegate {
+    WeakPtr<WebKit::AuthenticatorPresenterCoordinator> _coordinator;
+}
+
+- (instancetype)initWithCoordinator:(WebKit::AuthenticatorPresenterCoordinator&)coordinator
+{
+    if ((self = [super init]))
+        _coordinator = makeWeakPtr(coordinator);
+    return self;
+}
+
+- (void)authorizationPresenter:(ASCAuthorizationPresenter *)presenter credentialRequestedForLoginChoice:(id <ASCLoginChoiceProtocol>)loginChoice authenticatedContext:(nullable LAContext *)context completionHandler:(void (^)(id <ASCCredentialProtocol> _Nullable credential, NSError * _Nullable error))completionHandler
+{
+    // FIXME(219709): Adopt new UI for the Platform Authenticator makeCredential flow.
+}
+
+- (void)authorizationPresenter:(ASCAuthorizationPresenter *)presenter validateUserEnteredPIN:(NSString *)pin completionHandler:(void (^)(id <ASCCredentialProtocol> credential, NSError *error))completionHandler
+{
+    // FIXME(219712): Adopt new UI for the Client PIN flow.
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(IOS)

Modified: trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp (270615 => 270616)


--- trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp	2020-12-10 08:41:43 UTC (rev 270616)
@@ -42,6 +42,7 @@
     : m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
 {
     initialize(WTFMove(parameters));
+    m_authenticatorManager->enableModernWebAuthentication();
 }
 
 WebAuthnProcess::~WebAuthnProcess()
@@ -129,6 +130,7 @@
 {
     if (!m_authenticatorManager->isMock()) {
         m_authenticatorManager = makeUniqueRef<MockAuthenticatorManager>(WTFMove(configuration));
+        m_authenticatorManager->enableModernWebAuthentication();
         return;
     }
     static_cast<MockAuthenticatorManager*>(&m_authenticatorManager)->setTestConfiguration(WTFMove(configuration));

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (270615 => 270616)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-12-10 08:41:43 UTC (rev 270616)
@@ -1144,6 +1144,8 @@
 		575B1BBA23CE9C130020639A /* WebAutomationSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9955A6EA1C7980BB00EB6A93 /* WebAutomationSession.cpp */; };
 		576CA9D722B862180030143C /* SOAuthorizationNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317322B35148008D0E8B /* SOAuthorizationNSURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5772F206217DBD6A0056BF2C /* HidService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5772F204217DBD6A0056BF2C /* HidService.h */; };
+		57773991258037430059348B /* AuthenticatorPresenterCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5777398F258037430059348B /* AuthenticatorPresenterCoordinator.h */; };
+		577739952580388F0059348B /* WKASCAuthorizationPresenterDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 577739932580388F0059348B /* WKASCAuthorizationPresenterDelegate.h */; };
 		577FF7822346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */; };
 		577FF7852346ECAA004EDFB9 /* WebAuthenticationPanelClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */; };
 		578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; };
@@ -1207,6 +1209,10 @@
 		57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */; };
 		57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */; };
 		57EFC77E2550EB8600F9477D /* com.apple.WebKit.WebAuthn.sb in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57EFC77D2550EB8500F9477D /* com.apple.WebKit.WebAuthn.sb */; };
+		57FABB0F25817CF00059DC95 /* AuthenticationServicesCoreSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FABB0E25817CF00059DC95 /* AuthenticationServicesCoreSPI.h */; };
+		57FABB122581827C0059DC95 /* AuthenticationServicesCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FABB102581827C0059DC95 /* AuthenticationServicesCoreSoftLink.h */; };
+		57FABB132581827C0059DC95 /* AuthenticationServicesCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57FABB112581827C0059DC95 /* AuthenticationServicesCoreSoftLink.mm */; };
+		57FABB14258188230059DC95 /* SourcesCocoa.txt in Resources */ = {isa = PBXBuildFile; fileRef = 2D7DEBE121269D5F00B9F73C /* SourcesCocoa.txt */; };
 		57FD318022B35158008D0E8B /* NavigationSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317822B35149008D0E8B /* NavigationSOAuthorizationSession.h */; };
 		57FD318122B3515B008D0E8B /* PopUpSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */; };
 		57FD318222B3515E008D0E8B /* RedirectSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317422B35149008D0E8B /* RedirectSOAuthorizationSession.h */; };
@@ -4082,6 +4088,10 @@
 		57608299202BDAE200116678 /* WebAuthenticatorCoordinatorProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebAuthenticatorCoordinatorProxy.messages.in; sourceTree = "<group>"; };
 		5772F204217DBD6A0056BF2C /* HidService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidService.h; sourceTree = "<group>"; };
 		5772F205217DBD6A0056BF2C /* HidService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HidService.mm; sourceTree = "<group>"; };
+		5777398F258037430059348B /* AuthenticatorPresenterCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorPresenterCoordinator.h; sourceTree = "<group>"; };
+		57773990258037430059348B /* AuthenticatorPresenterCoordinator.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticatorPresenterCoordinator.mm; sourceTree = "<group>"; };
+		577739932580388F0059348B /* WKASCAuthorizationPresenterDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKASCAuthorizationPresenterDelegate.h; sourceTree = "<group>"; };
+		577739942580388F0059348B /* WKASCAuthorizationPresenterDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKASCAuthorizationPresenterDelegate.mm; sourceTree = "<group>"; };
 		577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIWebAuthenticationPanelClient.h; sourceTree = "<group>"; };
 		577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanelClient.h; sourceTree = "<group>"; };
 		577FF7842346ECAA004EDFB9 /* WebAuthenticationPanelClient.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAuthenticationPanelClient.mm; sourceTree = "<group>"; };
@@ -4167,6 +4177,9 @@
 		57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIWebAuthenticationPanel.h; sourceTree = "<group>"; };
 		57EBE269234676C5008D8AF9 /* APIWebAuthenticationPanel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = APIWebAuthenticationPanel.cpp; sourceTree = "<group>"; };
 		57EFC77D2550EB8500F9477D /* com.apple.WebKit.WebAuthn.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebKit.WebAuthn.sb; sourceTree = "<group>"; };
+		57FABB0E25817CF00059DC95 /* AuthenticationServicesCoreSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticationServicesCoreSPI.h; sourceTree = "<group>"; };
+		57FABB102581827C0059DC95 /* AuthenticationServicesCoreSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticationServicesCoreSoftLink.h; sourceTree = "<group>"; };
+		57FABB112581827C0059DC95 /* AuthenticationServicesCoreSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationServicesCoreSoftLink.mm; sourceTree = "<group>"; };
 		57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopUpSOAuthorizationSession.h; sourceTree = "<group>"; };
 		57FD317122B35148008D0E8B /* WKSOAuthorizationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSOAuthorizationDelegate.h; sourceTree = "<group>"; };
 		57FD317222B35148008D0E8B /* SOAuthorizationCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SOAuthorizationCoordinator.h; sourceTree = "<group>"; };
@@ -7505,6 +7518,7 @@
 			children = (
 				E3CAAA432413278A00CED2E2 /* AccessibilitySupportSPI.h */,
 				572EBBDC25392181000552B3 /* AppAttestSPI.h */,
+				57FABB0E25817CF00059DC95 /* AuthenticationServicesCoreSPI.h */,
 				1A5705101BE410E500874AF1 /* BlockSPI.h */,
 				E50620912542102000C43091 /* ContactsUISPI.h */,
 				37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */,
@@ -8631,6 +8645,10 @@
 			children = (
 				572EBBD92538F6A1000552B3 /* AppAttestInternalSoftLink.h */,
 				572EBBD82538F6A1000552B3 /* AppAttestInternalSoftLink.mm */,
+				57FABB102581827C0059DC95 /* AuthenticationServicesCoreSoftLink.h */,
+				57FABB112581827C0059DC95 /* AuthenticationServicesCoreSoftLink.mm */,
+				5777398F258037430059348B /* AuthenticatorPresenterCoordinator.h */,
+				57773990258037430059348B /* AuthenticatorPresenterCoordinator.mm */,
 				57AC8F4E217FEED90055438C /* HidConnection.h */,
 				57AC8F4F217FEED90055438C /* HidConnection.mm */,
 				5772F204217DBD6A0056BF2C /* HidService.h */,
@@ -8651,6 +8669,8 @@
 				570DAAAD23026F5C00E8FC04 /* NfcService.mm */,
 				577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */,
 				577FF7842346ECAA004EDFB9 /* WebAuthenticationPanelClient.mm */,
+				577739932580388F0059348B /* WKASCAuthorizationPresenterDelegate.h */,
+				577739942580388F0059348B /* WKASCAuthorizationPresenterDelegate.mm */,
 				570DAAC423037F7E00E8FC04 /* WKNFReaderSessionDelegate.h */,
 				570DAAC523037F7E00E8FC04 /* WKNFReaderSessionDelegate.mm */,
 			);
@@ -11310,8 +11330,11 @@
 				512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */,
 				518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */,
 				512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */,
+				57FABB122581827C0059DC95 /* AuthenticationServicesCoreSoftLink.h in Headers */,
+				57FABB0F25817CF00059DC95 /* AuthenticationServicesCoreSPI.h in Headers */,
 				57DCEDB1214C60480016B847 /* Authenticator.h in Headers */,
 				57DCEDAF214C603B0016B847 /* AuthenticatorManager.h in Headers */,
+				57773991258037430059348B /* AuthenticatorPresenterCoordinator.h in Headers */,
 				57DCEDB0214C60420016B847 /* AuthenticatorTransportService.h in Headers */,
 				9955A6EF1C79810800EB6A93 /* Automation.json in Headers */,
 				9955A6F51C7986E000EB6A93 /* AutomationBackendDispatchers.h in Headers */,
@@ -12034,6 +12057,7 @@
 				512E34E5130B4D0500ABD19A /* WKApplicationCacheManager.h in Headers */,
 				A13DC682207AA6B20066EF72 /* WKApplicationStateTrackingView.h in Headers */,
 				BC4075F4124FF0270068F20A /* WKArray.h in Headers */,
+				577739952580388F0059348B /* WKASCAuthorizationPresenterDelegate.h in Headers */,
 				512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */,
 				512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */,
 				37C4C08D1814AC5C003688B9 /* WKBackForwardList.h in Headers */,
@@ -12743,6 +12767,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				57FABB14258188230059DC95 /* SourcesCocoa.txt in Resources */,
 				E1D26A53175964D90095BFD1 /* WebContentProcess.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -13391,6 +13416,7 @@
 				CD4570D424411D0F00A3DCEB /* AudioSessionRoutingArbitrator.cpp in Sources */,
 				CD4570D3244113B500A3DCEB /* AudioSessionRoutingArbitratorProxyMessageReceiver.cpp in Sources */,
 				512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */,
+				57FABB132581827C0059DC95 /* AuthenticationServicesCoreSoftLink.mm in Sources */,
 				9955A6F41C7986DC00EB6A93 /* AutomationBackendDispatchers.cpp in Sources */,
 				99249AD51F1F1E5600B62FBB /* AutomationFrontendDispatchers.cpp in Sources */,
 				9955A6F61C7986E300EB6A93 /* AutomationProtocolObjects.cpp in Sources */,

Modified: trunk/Tools/ChangeLog (270615 => 270616)


--- trunk/Tools/ChangeLog	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Tools/ChangeLog	2020-12-10 08:41:43 UTC (rev 270616)
@@ -1,3 +1,15 @@
+2020-12-10  Jiewen Tan  <jiewen_...@apple.com>
+
+        [WebAuthn] Adopt new UI for the Security Key makeCredential flow
+        https://bugs.webkit.org/show_bug.cgi?id=219708
+        <rdar://problem/72154735>
+
+        Reviewed by Brent Fulgham.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+        (TestWebKitAPI::TEST):
+        Adjusted to the new behavior.
+
 2020-12-09  Cathie Chen  <cathiec...@igalia.com>
 
         Support overscroll-behavior parsing

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (270615 => 270616)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2020-12-10 07:51:45 UTC (rev 270615)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2020-12-10 08:41:43 UTC (rev 270616)
@@ -390,7 +390,8 @@
 
 } // namesapce;
 
-TEST(WebAuthenticationPanel, NoPanelTimeout)
+#if HAVE(NEAR_FIELD)
+TEST(WebAuthenticationPanel, NoPanelNfcSucceed)
 {
     RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-get-assertion-nfc" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
 
@@ -400,8 +401,9 @@
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect configuration:configuration]);
 
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
-    [webView waitForMessage:@"Operation timed out."];
+    [webView waitForMessage:@"Succeeded!"];
 }
+#endif
 
 TEST(WebAuthenticationPanel, NoPanelHidSuccess)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to