[WebAuthN] Make AuthenticatorManager
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 22:22:36 +0000 (22:22 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 22:22:36 +0000 (22:22 +0000)
commit1fab56f0114c2031d053e1f6742834f84f281e00
treed194f0fc972907dcce0ab0c633fa56ab858b8789
parentc595a1925be6e1772fba4b41962283ff7b7e45d7
[WebAuthN] Make AuthenticatorManager
https://bugs.webkit.org/show_bug.cgi?id=189279
<rdar://problem/44116792>

Reviewed by Chris Dumez.

Source/WebCore:

This patch does the following things in WebCore in order to support AuthenticatorManager:
1) It separates AuthenticatorTransport from PublicKeyCredentialDescriptor such that the enum
can be queried from WebKit directly.
2) It adds AuthenticatorAttachment to PublicKeyCredentialCreationOptions such that relying parties
could express their interests in cross platform authenticators.
3) It enhances IPC encoder/decoder of a few such that Vectors and empty objects can be correctly coded.
4) It moves the LocalAuthenticator implementation to WebKit to better integrate with AuthenticatorManager.
5) It moves linking to LocalAuthentication.framework to WebKit as well.
6) It temporarily bans old mock test mechanism in Internals so we could enable the new mock test mechanism in
WebKitTestRunner which we will have a better coverage of codes in UI Process. Those tests will be either
removed or ported to the new mechanism in Bug 189283.
7) It also removes "using namespace WebCore" from the top namespace in some .mm files as they are reordered
to where they could introduce name confusions.

Tests: http/wpt/webauthn/public-key-credential-create-failure-local.https.html
       http/wpt/webauthn/public-key-credential-create-success-local.https.html
       http/wpt/webauthn/public-key-credential-get-failure-local.https.html
       http/wpt/webauthn/public-key-credential-get-success-local.https.html
       http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html

* CMakeLists.txt:
* Configurations/WebCore.xcconfig:
* DerivedSources.make:
* Modules/webauthn/AuthenticatorTransport.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* Modules/webauthn/AuthenticatorTransport.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl.
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
(WebCore::PublicKeyCredentialCreationOptions::encode const):
(WebCore::PublicKeyCredentialCreationOptions::decode):
* Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
* Modules/webauthn/PublicKeyCredentialData.h:
(WebCore::PublicKeyCredentialData::encode const):
(WebCore::PublicKeyCredentialData::decode):
* Modules/webauthn/PublicKeyCredentialDescriptor.h:
(WebCore::PublicKeyCredentialDescriptor::encode const):
* Modules/webauthn/PublicKeyCredentialDescriptor.idl:
* Modules/webauthn/cocoa/LocalAuthenticator.mm: Removed.
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/ExceptionData.h:
* platform/cocoa/LocalAuthenticationSoftLink.mm: Removed.
* platform/cocoa/SharedBufferCocoa.mm:
(-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
* platform/cocoa/VideoFullscreenModelVideoElement.mm:
(VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement): Deleted.
(VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement): Deleted.
(VideoFullscreenModelVideoElement::setVideoElement): Deleted.
(VideoFullscreenModelVideoElement::handleEvent): Deleted.
(VideoFullscreenModelVideoElement::updateForEventName): Deleted.
(VideoFullscreenModelVideoElement::willExitFullscreen): Deleted.
(VideoFullscreenModelVideoElement::setVideoFullscreenLayer): Deleted.
(VideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Deleted.
(VideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
(VideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
(VideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
(VideoFullscreenModelVideoElement::observedEventNames): Deleted.
(VideoFullscreenModelVideoElement::eventNameAll): Deleted.
(VideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
(VideoFullscreenModelVideoElement::addClient): Deleted.
(VideoFullscreenModelVideoElement::removeClient): Deleted.
(VideoFullscreenModelVideoElement::isVisible const): Deleted.
(VideoFullscreenModelVideoElement::setHasVideo): Deleted.
(VideoFullscreenModelVideoElement::setVideoDimensions): Deleted.
(VideoFullscreenModelVideoElement::willEnterPictureInPicture): Deleted.
(VideoFullscreenModelVideoElement::didEnterPictureInPicture): Deleted.
(VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): Deleted.
(VideoFullscreenModelVideoElement::willExitPictureInPicture): Deleted.
(VideoFullscreenModelVideoElement::didExitPictureInPicture): Deleted.
* platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
(WebCore::hasExplicitBeginTime):
(WebCore::setHasExplicitBeginTime):
(WebCore::toCAFillModeType):
(WebCore::toCAValueFunctionType):
(WebCore::toCAMediaTimingFunction):
(WebCore::PlatformCAAnimationCocoa::setFromValue):
(WebCore::PlatformCAAnimationCocoa::setToValue):
(WebCore::PlatformCAAnimationCocoa::setValues):
(fromCAFillModeType): Deleted.
(fromCAValueFunctionType): Deleted.
(PlatformCAAnimationCocoa::create): Deleted.
(PlatformCAAnimationCocoa::PlatformCAAnimationCocoa): Deleted.
(PlatformCAAnimationCocoa::~PlatformCAAnimationCocoa): Deleted.
(PlatformCAAnimationCocoa::copy const): Deleted.
(PlatformCAAnimationCocoa::platformAnimation const): Deleted.
(PlatformCAAnimationCocoa::keyPath const): Deleted.
(PlatformCAAnimationCocoa::beginTime const): Deleted.
(PlatformCAAnimationCocoa::setBeginTime): Deleted.
(PlatformCAAnimationCocoa::duration const): Deleted.
(PlatformCAAnimationCocoa::setDuration): Deleted.
(PlatformCAAnimationCocoa::speed const): Deleted.
(PlatformCAAnimationCocoa::setSpeed): Deleted.
(PlatformCAAnimationCocoa::timeOffset const): Deleted.
(PlatformCAAnimationCocoa::setTimeOffset): Deleted.
(PlatformCAAnimationCocoa::repeatCount const): Deleted.
(PlatformCAAnimationCocoa::setRepeatCount): Deleted.
(PlatformCAAnimationCocoa::autoreverses const): Deleted.
(PlatformCAAnimationCocoa::setAutoreverses): Deleted.
(PlatformCAAnimationCocoa::fillMode const): Deleted.
(PlatformCAAnimationCocoa::setFillMode): Deleted.
(PlatformCAAnimationCocoa::setTimingFunction): Deleted.
(PlatformCAAnimationCocoa::copyTimingFunctionFrom): Deleted.
(PlatformCAAnimationCocoa::isRemovedOnCompletion const): Deleted.
(PlatformCAAnimationCocoa::setRemovedOnCompletion): Deleted.
(PlatformCAAnimationCocoa::isAdditive const): Deleted.
(PlatformCAAnimationCocoa::setAdditive): Deleted.
(PlatformCAAnimationCocoa::valueFunction const): Deleted.
(PlatformCAAnimationCocoa::setValueFunction): Deleted.
(PlatformCAAnimationCocoa::setFromValue): Deleted.
(PlatformCAAnimationCocoa::copyFromValueFrom): Deleted.
(PlatformCAAnimationCocoa::setToValue): Deleted.
(PlatformCAAnimationCocoa::copyToValueFrom): Deleted.
(PlatformCAAnimationCocoa::setValues): Deleted.
(PlatformCAAnimationCocoa::copyValuesFrom): Deleted.
(PlatformCAAnimationCocoa::setKeyTimes): Deleted.
(PlatformCAAnimationCocoa::copyKeyTimesFrom): Deleted.
(PlatformCAAnimationCocoa::setTimingFunctions): Deleted.
(PlatformCAAnimationCocoa::copyTimingFunctionsFrom): Deleted.
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
(PlatformCAFilters::filterValueForOperation): Deleted.
(PlatformCAFilters::colorMatrixValueForFilter): Deleted.
(PlatformCAFilters::setBlendingFiltersOnLayer): Deleted.
(PlatformCAFilters::numAnimatedFilterProperties): Deleted.
(PlatformCAFilters::animatedFilterPropertyName): Deleted.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(-[WebAnimationDelegate animationDidStart:]):
(-[WebAnimationDelegate animationDidStop:finished:]):
(-[WebAnimationDelegate setOwner:]):
(PlatformCALayerCocoa::create): Deleted.
(PlatformCALayer::platformCALayer): Deleted.
(mediaTimeToCurrentTime): Deleted.
(PlatformCALayerCocoa::setOwner): Deleted.
(toCAFilterType): Deleted.
(PlatformCALayerCocoa::layerTypeForPlatformLayer): Deleted.
(PlatformCALayerCocoa::PlatformCALayerCocoa): Deleted.
(PlatformCALayerCocoa::commonInit): Deleted.
(PlatformCALayerCocoa::clone const): Deleted.
(PlatformCALayerCocoa::~PlatformCALayerCocoa): Deleted.
(PlatformCALayerCocoa::animationStarted): Deleted.
(PlatformCALayerCocoa::animationEnded): Deleted.
(PlatformCALayerCocoa::setNeedsDisplay): Deleted.
(PlatformCALayerCocoa::setNeedsDisplayInRect): Deleted.
(PlatformCALayerCocoa::copyContentsFromLayer): Deleted.
(PlatformCALayerCocoa::superlayer const): Deleted.
(PlatformCALayerCocoa::removeFromSuperlayer): Deleted.
(PlatformCALayerCocoa::setSublayers): Deleted.
(PlatformCALayerCocoa::removeAllSublayers): Deleted.
(PlatformCALayerCocoa::appendSublayer): Deleted.
(PlatformCALayerCocoa::insertSublayer): Deleted.
(PlatformCALayerCocoa::replaceSublayer): Deleted.
(PlatformCALayerCocoa::adoptSublayers): Deleted.
(PlatformCALayerCocoa::addAnimationForKey): Deleted.
(PlatformCALayerCocoa::removeAnimationForKey): Deleted.
(PlatformCALayerCocoa::animationForKey): Deleted.
(PlatformCALayerCocoa::setMask): Deleted.
(PlatformCALayerCocoa::isOpaque const): Deleted.
(PlatformCALayerCocoa::setOpaque): Deleted.
(PlatformCALayerCocoa::bounds const): Deleted.
(PlatformCALayerCocoa::setBounds): Deleted.
(PlatformCALayerCocoa::position const): Deleted.
(PlatformCALayerCocoa::setPosition): Deleted.
(PlatformCALayerCocoa::anchorPoint const): Deleted.
(PlatformCALayerCocoa::setAnchorPoint): Deleted.
(PlatformCALayerCocoa::transform const): Deleted.
(PlatformCALayerCocoa::setTransform): Deleted.
(PlatformCALayerCocoa::sublayerTransform const): Deleted.
(PlatformCALayerCocoa::setSublayerTransform): Deleted.
(PlatformCALayerCocoa::isHidden const): Deleted.
(PlatformCALayerCocoa::setHidden): Deleted.
(PlatformCALayerCocoa::contentsHidden const): Deleted.
(PlatformCALayerCocoa::setContentsHidden): Deleted.
(PlatformCALayerCocoa::userInteractionEnabled const): Deleted.
(PlatformCALayerCocoa::setUserInteractionEnabled): Deleted.
(PlatformCALayerCocoa::setBackingStoreAttached): Deleted.
(PlatformCALayerCocoa::backingStoreAttached const): Deleted.
(PlatformCALayerCocoa::geometryFlipped const): Deleted.
(PlatformCALayerCocoa::setGeometryFlipped): Deleted.
(PlatformCALayerCocoa::isDoubleSided const): Deleted.
(PlatformCALayerCocoa::setDoubleSided): Deleted.
(PlatformCALayerCocoa::masksToBounds const): Deleted.
(PlatformCALayerCocoa::setMasksToBounds): Deleted.
(PlatformCALayerCocoa::acceleratesDrawing const): Deleted.
(PlatformCALayerCocoa::setAcceleratesDrawing): Deleted.
(PlatformCALayerCocoa::wantsDeepColorBackingStore const): Deleted.
(PlatformCALayerCocoa::setWantsDeepColorBackingStore): Deleted.
(PlatformCALayerCocoa::supportsSubpixelAntialiasedText const): Deleted.
(PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText): Deleted.
(PlatformCALayerCocoa::hasContents const): Deleted.
(PlatformCALayerCocoa::contents const): Deleted.
(PlatformCALayerCocoa::setContents): Deleted.
(PlatformCALayerCocoa::setContentsRect): Deleted.
(PlatformCALayerCocoa::setMinificationFilter): Deleted.
(PlatformCALayerCocoa::setMagnificationFilter): Deleted.
(PlatformCALayerCocoa::backgroundColor const): Deleted.
(PlatformCALayerCocoa::setBackgroundColor): Deleted.
(PlatformCALayerCocoa::setBorderWidth): Deleted.
(PlatformCALayerCocoa::setBorderColor): Deleted.
(PlatformCALayerCocoa::opacity const): Deleted.
(PlatformCALayerCocoa::setOpacity): Deleted.
(PlatformCALayerCocoa::setFilters): Deleted.
(PlatformCALayerCocoa::copyFiltersFrom): Deleted.
(PlatformCALayerCocoa::filtersCanBeComposited): Deleted.
(PlatformCALayerCocoa::setBlendMode): Deleted.
(PlatformCALayerCocoa::setName): Deleted.
(PlatformCALayerCocoa::setSpeed): Deleted.
(PlatformCALayerCocoa::setTimeOffset): Deleted.
(PlatformCALayerCocoa::contentsScale const): Deleted.
(PlatformCALayerCocoa::setContentsScale): Deleted.
(PlatformCALayerCocoa::cornerRadius const): Deleted.
(PlatformCALayerCocoa::setCornerRadius): Deleted.
(PlatformCALayerCocoa::setEdgeAntialiasingMask): Deleted.
(PlatformCALayerCocoa::shapeRoundedRect const): Deleted.
(PlatformCALayerCocoa::setShapeRoundedRect): Deleted.
(PlatformCALayerCocoa::shapeWindRule const): Deleted.
(PlatformCALayerCocoa::setShapeWindRule): Deleted.
(PlatformCALayerCocoa::shapePath const): Deleted.
(PlatformCALayerCocoa::setShapePath): Deleted.
(PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const): Deleted.
(PlatformCALayerCocoa::updateCustomAppearance): Deleted.
(layerContentsFormat): Deleted.
(PlatformCALayerCocoa::updateContentsFormat): Deleted.
(PlatformCALayerCocoa::tiledBacking): Deleted.
(PlatformCALayer::isWebLayer): Deleted.
(PlatformCALayer::setBoundsOnMainThread): Deleted.
(PlatformCALayer::setPositionOnMainThread): Deleted.
(PlatformCALayer::setAnchorPointOnMainThread): Deleted.
(PlatformCALayer::collectRectsToPaint): Deleted.
(PlatformCALayer::drawLayerContents): Deleted.
(PlatformCALayer::frameForLayer): Deleted.
(PlatformCALayerCocoa::createCompatibleLayer const): Deleted.
(PlatformCALayerCocoa::enumerateRectsBeingDrawn): Deleted.
(PlatformCALayerCocoa::backingStoreBytesPerPixel const): Deleted.
(PlatformCALayerCocoa::avPlayerLayer const): Deleted.
* platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm:
(-[WebLightSystemBackdropLayer init]):
(-[WebDarkSystemBackdropLayer init]):
* platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
(-[WebTiledBackingLayer createTileController:]):
(-[WebTiledBackingLayer setNeedsDisplayInRect:]):
(-[WebTiledBackingLayer setBorderColor:]):
* testing/Internals.cpp:
(WebCore::Internals::Internals):

Source/WebCore/PAL:

It moves linking to DeviceIdentity.framework to WebKit.

* PAL.xcodeproj/project.pbxproj:

Source/WebKit:

This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles
web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI.
The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton
per UI Process.

1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will
then distribute requests whenever a new authenticator is discovered.

2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke
startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService
is the one that discover attached platform authenticators, for example, TouchID or FaceID.

Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB,
NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to
*Service, so the latter can inform the former whenever an authenticator is added or removed.

When a new authenticator is discovered, the corresponding service will create an Authetnicator object that
binds to the physical authenticator device through a *Connection object. There is no ABC for connection for
now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive
messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators
are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's
request handling process. So we can override them in a mock test environment. I will talk about this in the
next section.

3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests
will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that
works asynchronously.

For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End,
and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to
UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID
or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to
DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator
implementation, and this patch converts it to a FSM and simplify the callback and threading model.

When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager.
AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise,
the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642.

The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here:
1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in
the interface of the ABC.
2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated
thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback
into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence,
weak pointers in the actual callback are guaranteed to work.
3) Callbacks are used only if it is one way, and they are CompletionHandlers.
4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces.

Finally, let me explain how the mock test works:
1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess
instead of WebProcess, says, the AuthenticatorManager.
2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best
possible coverage in auto tests.
3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is
provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object.
4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error.
5) Also, Mock*Service classes are made to mock the discovery process as well.
6) Noted, every mock overrided methods are made thin.

* CMakeLists.txt:
* Configurations/WebKit.xcconfig:
* Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
* SourcesCocoa.txt:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
(WebKit::Authenticator::handleRequest):
(WebKit::Authenticator::receiveRespond const):
* UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h.
(WebKit::Authenticator::setObserver):
(WebKit::Authenticator::observer const):
(WebKit::Authenticator::requestData const):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added.
(WebKit::AuthenticatorManagerInternal::collectTransports):
(WebKit::AuthenticatorManager::makeCredential):
(WebKit::AuthenticatorManager::getAssertion):
(WebKit::AuthenticatorManager::clearState):
(WebKit::AuthenticatorManager::authenticatorAdded):
(WebKit::AuthenticatorManager::respondReceived):
(WebKit::AuthenticatorManager::createService const):
(WebKit::AuthenticatorManager::respondReceivedInternal):
(WebKit::AuthenticatorManager::startDiscovery):
* UIProcess/WebAuthentication/AuthenticatorManager.h: Added.
(WebKit::AuthenticatorManager::pendingCompletionHandler):
* UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
(WebKit::AuthenticatorTransportService::create):
(WebKit::AuthenticatorTransportService::createMock):
(WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
(WebKit::AuthenticatorTransportService::startDiscovery const):
* UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
(WebKit::AuthenticatorTransportService::observer const):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added.
(WebKit::LocalAuthenticatorInternal::buildAuthData):
(WebKit::LocalAuthenticatorInternal::transportsContain):
(WebKit::LocalAuthenticatorInternal::produceHashSet):
(WebKit::LocalAuthenticatorInternal::toVector):
(WebKit::LocalAuthenticator::LocalAuthenticator):
(WebKit::LocalAuthenticator::makeCredential):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
(WebKit::LocalAuthenticator::getAssertion):
(WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
* UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added.
(WebKit::LocalConnection::getUserConsent const):
(WebKit::LocalConnection::getAttestation const):
* UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
(WebKit::LocalService::LocalService):
(WebKit::LocalService::isAvailable):
(WebKit::LocalService::startDiscoveryInternal const):
(WebKit::LocalService::platformStartDiscovery const):
(WebKit::LocalService::createLocalConnection const):
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
(WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
(WebKit::MockAuthenticatorManager::createService const):
(WebKit::MockAuthenticatorManager::respondReceivedInternal):
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added.
(WebKit::MockLocalConnection::MockLocalConnection):
(WebKit::MockLocalConnection::getUserConsent const):
(WebKit::MockLocalConnection::getAttestation const):
* UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
(WebKit::MockLocalService::MockLocalService):
(WebKit::MockLocalService::platformStartDiscovery const):
(WebKit::MockLocalService::createLocalConnection const):
* UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
(WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::authenticatorManager):
* WebKit.xcodeproj/project.pbxproj:

Tools:

Besides the functionality to set the WebAuthenticationMockConfiguration. Three operations are
added to manipulate Keychain: addTestKeyToKeychain, cleanUpKeychain and keyExistedInKeychain.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/LocalAuthenticator.mm: Removed.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebAuthenticationMockConfiguration):
(WTR::TestRunner::addTestKeyToKeychain):
(WTR::TestRunner::cleanUpKeychain):
(WTR::TestRunner::isKeyExisted):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::addTestKeyToKeychain):
(WTR::TestController::cleanUpKeychain):
(WTR::TestController::isKeyExisted):
(WTR::TestController::setWebAuthenticationMockConfiguration):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::addTestKeyToKeychain):
(WTR::TestController::cleanUpKeychain):
(WTR::TestController::keyExistedInKeychain):

LayoutTests:

Most of the new tests are rewritten from the LocalAuthenticator API tests. Old mock tests are temporarily skipped
for the new mock tests.

* TestExpectations:
* http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-failure-local.https.html: Added.
* http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-success-local.https.html: Added.
* http/wpt/webauthn/public-key-credential-create-success.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-failure-local.https.html: Added.
* http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-success-local.https.html: Added.
* http/wpt/webauthn/public-key-credential-get-success.https.html:
* http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html: Added.
* http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available-expected.txt: Removed.
* http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html: Removed.
* http/wpt/webauthn/resources/util.js:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
89 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available-expected.txt [deleted file]
LayoutTests/http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html [deleted file]
LayoutTests/http/wpt/webauthn/resources/util.js
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webauthn/AuthenticatorTransport.h [new file with mode: 0644]
Source/WebCore/Modules/webauthn/AuthenticatorTransport.idl [new file with mode: 0644]
Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h
Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.idl
Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h
Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h
Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl
Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.mm [deleted file]
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/Sources.txt
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/ExceptionData.h
Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.mm [deleted file]
Source/WebCore/platform/cocoa/SharedBufferCocoa.mm
Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm
Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm
Source/WebCore/testing/Internals.cpp
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/Platform/spi/Cocoa/DeviceIdentitySPI.h [moved from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h with 100% similarity]
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Source/WebKit/UIProcess/WebAuthentication/Authenticator.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Authenticator.h [moved from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h with 54% similarity]
Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h [moved from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h with 88% similarity]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp
Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/ios/LocalAuthenticator.mm [deleted file]
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm