Changeset 236481 in webkit


Ignore:
Timestamp:
Sep 25, 2018, 3:22:36 PM (7 years ago)
Author:
jiewen_tan@apple.com
Message:

[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:
Location:
trunk
Files:
17 added
5 deleted
50 edited
17 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r236473 r236481  
     12018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Make AuthenticatorManager
     4        https://bugs.webkit.org/show_bug.cgi?id=189279
     5        <rdar://problem/44116792>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Most of the new tests are rewritten from the LocalAuthenticator API tests. Old mock tests are temporarily skipped
     10        for the new mock tests.
     11
     12        * TestExpectations:
     13        * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: Added.
     14        * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: Added.
     15        * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: Added.
     16        * http/wpt/webauthn/public-key-credential-create-success-local.https.html: Added.
     17        * http/wpt/webauthn/public-key-credential-create-success.https.html:
     18        * http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt: Added.
     19        * http/wpt/webauthn/public-key-credential-get-failure-local.https.html: Added.
     20        * http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt: Added.
     21        * http/wpt/webauthn/public-key-credential-get-success-local.https.html: Added.
     22        * http/wpt/webauthn/public-key-credential-get-success.https.html:
     23        * http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available-expected.txt: Added.
     24        * http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html: Added.
     25        * http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available-expected.txt: Removed.
     26        * http/wpt/webauthn/public-key-is-user-verifying-platform-authenticator-available.html: Removed.
     27        * http/wpt/webauthn/resources/util.js:
     28        * platform/mac-wk2/TestExpectations:
     29
    1302018-09-25  Ryan Haddad  <ryanhaddad@apple.com>
    231
  • trunk/LayoutTests/TestExpectations

    r236448 r236481  
    28632863
    28642864webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ]
     2865
     2866# Temporary disables old WebAuthN tests, will either reenable or remove them in webkit.org/b/189283
     2867http/wpt/credential-management/credentialscontainer-store-basics.https.html [ Skip ]
     2868http/wpt/webauthn/public-key-credential-create-failure.https.html [ Skip ]
     2869http/wpt/webauthn/public-key-credential-create-success.https.html [ Skip ]
     2870http/wpt/webauthn/public-key-credential-get-failure.https.html [ Skip ]
     2871http/wpt/webauthn/public-key-credential-get-success.https.html [ Skip ]
     2872http/wpt/webauthn/idl.https.html [ Skip ]
  • trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html

    r235888 r236481  
    2929                assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.create","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}');
    3030                assert_equals(bytesToHexString(credential.response.attestationObject), '01');
    31                 console.log()
    32                 try {
    33                     assert_throws("NotSupportedError", credential.getClientExtensionResults());
    34                 } catch(error) { }
     31                assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() });
    3532            });
    3633    }, "PublicKeyCredential's [[create]] with minimum options");
  • trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html

    r235888 r236481  
    2323            assert_equals(bytesToHexString(credential.response.signature), '02');
    2424            assert_equals(bytesToHexString(credential.response.userHandle), '03');
    25             try {
    26                 assert_throws("NotSupportedError", credential.getClientExtensionResults());
    27             } catch(error) { }
     25            assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() });
    2826        });
    2927    }, "PublicKeyCredential's [[get]] with minimum options");
  • trunk/LayoutTests/http/wpt/webauthn/resources/util.js

    r228523 r236481  
    6060    return arrayBuffer;
    6161}
     62
     63function decodeAuthData(authDataUint8Array)
     64{
     65    let authDataObject = { };
     66    let pos = 0;
     67    let size = 0;
     68
     69    // RP ID Hash
     70    size = 32;
     71    if (pos + size > authDataUint8Array.byteLength)
     72        return { };
     73    authDataObject.rpIdHash = authDataUint8Array.slice(pos, pos + size);
     74    pos = pos + size;
     75
     76    // FLAGS
     77    size = 1;
     78    if (pos + size > authDataUint8Array.byteLength)
     79        return { };
     80    authDataObject.flags = authDataUint8Array.slice(pos, pos + size)[0];
     81    pos = pos + size;
     82
     83    // Counter
     84    size = 4;
     85    if (pos + size > authDataUint8Array.byteLength)
     86        return { };
     87    authDataObject.counter = new Uint32Array(authDataUint8Array.slice(pos, pos + size))[0];
     88    pos = pos + size;
     89
     90    if (pos == authDataUint8Array.byteLength)
     91        return authDataObject;
     92
     93    // AAGUID
     94    size = 16;
     95    if (pos + size > authDataUint8Array.byteLength)
     96        return { };
     97    authDataObject.aaguid = authDataUint8Array.slice(pos, pos + size);
     98    pos = pos + size;
     99
     100    // L
     101    size = 2;
     102    if (pos + size > authDataUint8Array.byteLength)
     103        return { };
     104    // Little Endian
     105    authDataObject.l = new Uint16Array(authDataUint8Array.slice(pos, pos + size))[0];
     106    pos = pos + size;
     107
     108    // Credential ID
     109    size = authDataObject.l;
     110    if (pos + size > authDataUint8Array.byteLength)
     111        return { };
     112    authDataObject.credentialID = authDataUint8Array.slice(pos, pos + size);
     113    pos = pos + size;
     114
     115    // FIXME(): Add CBOR decoder to parse the public key.
     116
     117    // Assume no extensions.
     118    return authDataObject;
     119}
     120
     121function concatenateBuffers(buffer1, buffer2)
     122{
     123    let tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
     124    tmp.set(new Uint8Array(buffer1), 0);
     125    tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
     126    return tmp.buffer;
     127}
     128
     129// Very dirty asn1 decoder. Just works.
     130function extractRawSignature(asn1signature)
     131{
     132    const signature = new Uint8Array(asn1signature);
     133    let tmp = new Uint8Array(64);
     134    const rStart =  signature[3] - 32;
     135    tmp.set(new Uint8Array(signature.slice(4 + rStart, 36 + rStart)), 0);
     136    const sStart =  signature[37 + rStart] - 32;
     137    tmp.set(new Uint8Array(signature.slice(38 + rStart + sStart)), 32);
     138    return tmp.buffer;
     139}
     140
     141const testCredentialIdBase64url = "SMSXHngF7hEOsElA73C3RY-8bR4";
     142const testES256PrivateKeyBase64 =
     143    "BDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749VBJPgqUIwfhWHJ91nb7U" +
     144    "PH76c0+WFOzZKslPyyFse4goGIW2R7k9VHLPEZl5nfnBgEVFh5zev+/xpHQIvuq6" +
     145    "RQ==";
     146const testES256PublicKeyBase64url =
     147    "BDj_zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF_Qm1749VBJPgqUIwfhWHJ91nb7U" +
     148    "PH76c0-WFOzZKslPyyFse4g";
     149const testRpId = "localhost";
     150const testUserhandleBase64 = "AAECAwQFBgcICQ==";
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r236473 r236481  
    883883
    884884webkit.org/b/189598 compositing/backing/backing-store-attachment-fill-forwards-animation.html [ Pass Failure ]
     885
     886# Skip local authenticator tests for mac now.
     887http/wpt/webauthn/public-key-credential-create-failure-local.https.html [ Skip ]
     888http/wpt/webauthn/public-key-credential-create-success-local.https.html [ Skip ]
     889http/wpt/webauthn/public-key-credential-get-failure-local.https.html [ Skip ]
     890http/wpt/webauthn/public-key-credential-get-success-local.https.html [ Skip ]
  • trunk/Source/WebCore/CMakeLists.txt

    r236429 r236481  
    416416    Modules/webauthn/AuthenticatorAttestationResponse.idl
    417417    Modules/webauthn/AuthenticatorResponse.idl
     418    Modules/webauthn/AuthenticatorTransport.idl
    418419    Modules/webauthn/PublicKeyCredential.idl
    419420    Modules/webauthn/PublicKeyCredentialCreationOptions.idl
  • trunk/Source/WebCore/ChangeLog

    r236478 r236481  
     12018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Make AuthenticatorManager
     4        https://bugs.webkit.org/show_bug.cgi?id=189279
     5        <rdar://problem/44116792>
     6
     7        Reviewed by Chris Dumez.
     8
     9        This patch does the following things in WebCore in order to support AuthenticatorManager:
     10        1) It separates AuthenticatorTransport from PublicKeyCredentialDescriptor such that the enum
     11        can be queried from WebKit directly.
     12        2) It adds AuthenticatorAttachment to PublicKeyCredentialCreationOptions such that relying parties
     13        could express their interests in cross platform authenticators.
     14        3) It enhances IPC encoder/decoder of a few such that Vectors and empty objects can be correctly coded.
     15        4) It moves the LocalAuthenticator implementation to WebKit to better integrate with AuthenticatorManager.
     16        5) It moves linking to LocalAuthentication.framework to WebKit as well.
     17        6) It temporarily bans old mock test mechanism in Internals so we could enable the new mock test mechanism in
     18        WebKitTestRunner which we will have a better coverage of codes in UI Process. Those tests will be either
     19        removed or ported to the new mechanism in Bug 189283.
     20        7) It also removes "using namespace WebCore" from the top namespace in some .mm files as they are reordered
     21        to where they could introduce name confusions.
     22
     23        Tests: http/wpt/webauthn/public-key-credential-create-failure-local.https.html
     24               http/wpt/webauthn/public-key-credential-create-success-local.https.html
     25               http/wpt/webauthn/public-key-credential-get-failure-local.https.html
     26               http/wpt/webauthn/public-key-credential-get-success-local.https.html
     27               http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html
     28
     29        * CMakeLists.txt:
     30        * Configurations/WebCore.xcconfig:
     31        * DerivedSources.make:
     32        * Modules/webauthn/AuthenticatorTransport.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     33        * Modules/webauthn/AuthenticatorTransport.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl.
     34        * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
     35        (WebCore::PublicKeyCredentialCreationOptions::encode const):
     36        (WebCore::PublicKeyCredentialCreationOptions::decode):
     37        * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
     38        * Modules/webauthn/PublicKeyCredentialData.h:
     39        (WebCore::PublicKeyCredentialData::encode const):
     40        (WebCore::PublicKeyCredentialData::decode):
     41        * Modules/webauthn/PublicKeyCredentialDescriptor.h:
     42        (WebCore::PublicKeyCredentialDescriptor::encode const):
     43        * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
     44        * Modules/webauthn/cocoa/LocalAuthenticator.mm: Removed.
     45        * Sources.txt:
     46        * SourcesCocoa.txt:
     47        * WebCore.xcodeproj/project.pbxproj:
     48        * dom/ExceptionData.h:
     49        * platform/cocoa/LocalAuthenticationSoftLink.mm: Removed.
     50        * platform/cocoa/SharedBufferCocoa.mm:
     51        (-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
     52        * platform/cocoa/VideoFullscreenModelVideoElement.mm:
     53        (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement): Deleted.
     54        (VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement): Deleted.
     55        (VideoFullscreenModelVideoElement::setVideoElement): Deleted.
     56        (VideoFullscreenModelVideoElement::handleEvent): Deleted.
     57        (VideoFullscreenModelVideoElement::updateForEventName): Deleted.
     58        (VideoFullscreenModelVideoElement::willExitFullscreen): Deleted.
     59        (VideoFullscreenModelVideoElement::setVideoFullscreenLayer): Deleted.
     60        (VideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Deleted.
     61        (VideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
     62        (VideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
     63        (VideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
     64        (VideoFullscreenModelVideoElement::observedEventNames): Deleted.
     65        (VideoFullscreenModelVideoElement::eventNameAll): Deleted.
     66        (VideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
     67        (VideoFullscreenModelVideoElement::addClient): Deleted.
     68        (VideoFullscreenModelVideoElement::removeClient): Deleted.
     69        (VideoFullscreenModelVideoElement::isVisible const): Deleted.
     70        (VideoFullscreenModelVideoElement::setHasVideo): Deleted.
     71        (VideoFullscreenModelVideoElement::setVideoDimensions): Deleted.
     72        (VideoFullscreenModelVideoElement::willEnterPictureInPicture): Deleted.
     73        (VideoFullscreenModelVideoElement::didEnterPictureInPicture): Deleted.
     74        (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): Deleted.
     75        (VideoFullscreenModelVideoElement::willExitPictureInPicture): Deleted.
     76        (VideoFullscreenModelVideoElement::didExitPictureInPicture): Deleted.
     77        * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
     78        (WebCore::hasExplicitBeginTime):
     79        (WebCore::setHasExplicitBeginTime):
     80        (WebCore::toCAFillModeType):
     81        (WebCore::toCAValueFunctionType):
     82        (WebCore::toCAMediaTimingFunction):
     83        (WebCore::PlatformCAAnimationCocoa::setFromValue):
     84        (WebCore::PlatformCAAnimationCocoa::setToValue):
     85        (WebCore::PlatformCAAnimationCocoa::setValues):
     86        (fromCAFillModeType): Deleted.
     87        (fromCAValueFunctionType): Deleted.
     88        (PlatformCAAnimationCocoa::create): Deleted.
     89        (PlatformCAAnimationCocoa::PlatformCAAnimationCocoa): Deleted.
     90        (PlatformCAAnimationCocoa::~PlatformCAAnimationCocoa): Deleted.
     91        (PlatformCAAnimationCocoa::copy const): Deleted.
     92        (PlatformCAAnimationCocoa::platformAnimation const): Deleted.
     93        (PlatformCAAnimationCocoa::keyPath const): Deleted.
     94        (PlatformCAAnimationCocoa::beginTime const): Deleted.
     95        (PlatformCAAnimationCocoa::setBeginTime): Deleted.
     96        (PlatformCAAnimationCocoa::duration const): Deleted.
     97        (PlatformCAAnimationCocoa::setDuration): Deleted.
     98        (PlatformCAAnimationCocoa::speed const): Deleted.
     99        (PlatformCAAnimationCocoa::setSpeed): Deleted.
     100        (PlatformCAAnimationCocoa::timeOffset const): Deleted.
     101        (PlatformCAAnimationCocoa::setTimeOffset): Deleted.
     102        (PlatformCAAnimationCocoa::repeatCount const): Deleted.
     103        (PlatformCAAnimationCocoa::setRepeatCount): Deleted.
     104        (PlatformCAAnimationCocoa::autoreverses const): Deleted.
     105        (PlatformCAAnimationCocoa::setAutoreverses): Deleted.
     106        (PlatformCAAnimationCocoa::fillMode const): Deleted.
     107        (PlatformCAAnimationCocoa::setFillMode): Deleted.
     108        (PlatformCAAnimationCocoa::setTimingFunction): Deleted.
     109        (PlatformCAAnimationCocoa::copyTimingFunctionFrom): Deleted.
     110        (PlatformCAAnimationCocoa::isRemovedOnCompletion const): Deleted.
     111        (PlatformCAAnimationCocoa::setRemovedOnCompletion): Deleted.
     112        (PlatformCAAnimationCocoa::isAdditive const): Deleted.
     113        (PlatformCAAnimationCocoa::setAdditive): Deleted.
     114        (PlatformCAAnimationCocoa::valueFunction const): Deleted.
     115        (PlatformCAAnimationCocoa::setValueFunction): Deleted.
     116        (PlatformCAAnimationCocoa::setFromValue): Deleted.
     117        (PlatformCAAnimationCocoa::copyFromValueFrom): Deleted.
     118        (PlatformCAAnimationCocoa::setToValue): Deleted.
     119        (PlatformCAAnimationCocoa::copyToValueFrom): Deleted.
     120        (PlatformCAAnimationCocoa::setValues): Deleted.
     121        (PlatformCAAnimationCocoa::copyValuesFrom): Deleted.
     122        (PlatformCAAnimationCocoa::setKeyTimes): Deleted.
     123        (PlatformCAAnimationCocoa::copyKeyTimesFrom): Deleted.
     124        (PlatformCAAnimationCocoa::setTimingFunctions): Deleted.
     125        (PlatformCAAnimationCocoa::copyTimingFunctionsFrom): Deleted.
     126        * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
     127        (PlatformCAFilters::filterValueForOperation): Deleted.
     128        (PlatformCAFilters::colorMatrixValueForFilter): Deleted.
     129        (PlatformCAFilters::setBlendingFiltersOnLayer): Deleted.
     130        (PlatformCAFilters::numAnimatedFilterProperties): Deleted.
     131        (PlatformCAFilters::animatedFilterPropertyName): Deleted.
     132        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
     133        (-[WebAnimationDelegate animationDidStart:]):
     134        (-[WebAnimationDelegate animationDidStop:finished:]):
     135        (-[WebAnimationDelegate setOwner:]):
     136        (PlatformCALayerCocoa::create): Deleted.
     137        (PlatformCALayer::platformCALayer): Deleted.
     138        (mediaTimeToCurrentTime): Deleted.
     139        (PlatformCALayerCocoa::setOwner): Deleted.
     140        (toCAFilterType): Deleted.
     141        (PlatformCALayerCocoa::layerTypeForPlatformLayer): Deleted.
     142        (PlatformCALayerCocoa::PlatformCALayerCocoa): Deleted.
     143        (PlatformCALayerCocoa::commonInit): Deleted.
     144        (PlatformCALayerCocoa::clone const): Deleted.
     145        (PlatformCALayerCocoa::~PlatformCALayerCocoa): Deleted.
     146        (PlatformCALayerCocoa::animationStarted): Deleted.
     147        (PlatformCALayerCocoa::animationEnded): Deleted.
     148        (PlatformCALayerCocoa::setNeedsDisplay): Deleted.
     149        (PlatformCALayerCocoa::setNeedsDisplayInRect): Deleted.
     150        (PlatformCALayerCocoa::copyContentsFromLayer): Deleted.
     151        (PlatformCALayerCocoa::superlayer const): Deleted.
     152        (PlatformCALayerCocoa::removeFromSuperlayer): Deleted.
     153        (PlatformCALayerCocoa::setSublayers): Deleted.
     154        (PlatformCALayerCocoa::removeAllSublayers): Deleted.
     155        (PlatformCALayerCocoa::appendSublayer): Deleted.
     156        (PlatformCALayerCocoa::insertSublayer): Deleted.
     157        (PlatformCALayerCocoa::replaceSublayer): Deleted.
     158        (PlatformCALayerCocoa::adoptSublayers): Deleted.
     159        (PlatformCALayerCocoa::addAnimationForKey): Deleted.
     160        (PlatformCALayerCocoa::removeAnimationForKey): Deleted.
     161        (PlatformCALayerCocoa::animationForKey): Deleted.
     162        (PlatformCALayerCocoa::setMask): Deleted.
     163        (PlatformCALayerCocoa::isOpaque const): Deleted.
     164        (PlatformCALayerCocoa::setOpaque): Deleted.
     165        (PlatformCALayerCocoa::bounds const): Deleted.
     166        (PlatformCALayerCocoa::setBounds): Deleted.
     167        (PlatformCALayerCocoa::position const): Deleted.
     168        (PlatformCALayerCocoa::setPosition): Deleted.
     169        (PlatformCALayerCocoa::anchorPoint const): Deleted.
     170        (PlatformCALayerCocoa::setAnchorPoint): Deleted.
     171        (PlatformCALayerCocoa::transform const): Deleted.
     172        (PlatformCALayerCocoa::setTransform): Deleted.
     173        (PlatformCALayerCocoa::sublayerTransform const): Deleted.
     174        (PlatformCALayerCocoa::setSublayerTransform): Deleted.
     175        (PlatformCALayerCocoa::isHidden const): Deleted.
     176        (PlatformCALayerCocoa::setHidden): Deleted.
     177        (PlatformCALayerCocoa::contentsHidden const): Deleted.
     178        (PlatformCALayerCocoa::setContentsHidden): Deleted.
     179        (PlatformCALayerCocoa::userInteractionEnabled const): Deleted.
     180        (PlatformCALayerCocoa::setUserInteractionEnabled): Deleted.
     181        (PlatformCALayerCocoa::setBackingStoreAttached): Deleted.
     182        (PlatformCALayerCocoa::backingStoreAttached const): Deleted.
     183        (PlatformCALayerCocoa::geometryFlipped const): Deleted.
     184        (PlatformCALayerCocoa::setGeometryFlipped): Deleted.
     185        (PlatformCALayerCocoa::isDoubleSided const): Deleted.
     186        (PlatformCALayerCocoa::setDoubleSided): Deleted.
     187        (PlatformCALayerCocoa::masksToBounds const): Deleted.
     188        (PlatformCALayerCocoa::setMasksToBounds): Deleted.
     189        (PlatformCALayerCocoa::acceleratesDrawing const): Deleted.
     190        (PlatformCALayerCocoa::setAcceleratesDrawing): Deleted.
     191        (PlatformCALayerCocoa::wantsDeepColorBackingStore const): Deleted.
     192        (PlatformCALayerCocoa::setWantsDeepColorBackingStore): Deleted.
     193        (PlatformCALayerCocoa::supportsSubpixelAntialiasedText const): Deleted.
     194        (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText): Deleted.
     195        (PlatformCALayerCocoa::hasContents const): Deleted.
     196        (PlatformCALayerCocoa::contents const): Deleted.
     197        (PlatformCALayerCocoa::setContents): Deleted.
     198        (PlatformCALayerCocoa::setContentsRect): Deleted.
     199        (PlatformCALayerCocoa::setMinificationFilter): Deleted.
     200        (PlatformCALayerCocoa::setMagnificationFilter): Deleted.
     201        (PlatformCALayerCocoa::backgroundColor const): Deleted.
     202        (PlatformCALayerCocoa::setBackgroundColor): Deleted.
     203        (PlatformCALayerCocoa::setBorderWidth): Deleted.
     204        (PlatformCALayerCocoa::setBorderColor): Deleted.
     205        (PlatformCALayerCocoa::opacity const): Deleted.
     206        (PlatformCALayerCocoa::setOpacity): Deleted.
     207        (PlatformCALayerCocoa::setFilters): Deleted.
     208        (PlatformCALayerCocoa::copyFiltersFrom): Deleted.
     209        (PlatformCALayerCocoa::filtersCanBeComposited): Deleted.
     210        (PlatformCALayerCocoa::setBlendMode): Deleted.
     211        (PlatformCALayerCocoa::setName): Deleted.
     212        (PlatformCALayerCocoa::setSpeed): Deleted.
     213        (PlatformCALayerCocoa::setTimeOffset): Deleted.
     214        (PlatformCALayerCocoa::contentsScale const): Deleted.
     215        (PlatformCALayerCocoa::setContentsScale): Deleted.
     216        (PlatformCALayerCocoa::cornerRadius const): Deleted.
     217        (PlatformCALayerCocoa::setCornerRadius): Deleted.
     218        (PlatformCALayerCocoa::setEdgeAntialiasingMask): Deleted.
     219        (PlatformCALayerCocoa::shapeRoundedRect const): Deleted.
     220        (PlatformCALayerCocoa::setShapeRoundedRect): Deleted.
     221        (PlatformCALayerCocoa::shapeWindRule const): Deleted.
     222        (PlatformCALayerCocoa::setShapeWindRule): Deleted.
     223        (PlatformCALayerCocoa::shapePath const): Deleted.
     224        (PlatformCALayerCocoa::setShapePath): Deleted.
     225        (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const): Deleted.
     226        (PlatformCALayerCocoa::updateCustomAppearance): Deleted.
     227        (layerContentsFormat): Deleted.
     228        (PlatformCALayerCocoa::updateContentsFormat): Deleted.
     229        (PlatformCALayerCocoa::tiledBacking): Deleted.
     230        (PlatformCALayer::isWebLayer): Deleted.
     231        (PlatformCALayer::setBoundsOnMainThread): Deleted.
     232        (PlatformCALayer::setPositionOnMainThread): Deleted.
     233        (PlatformCALayer::setAnchorPointOnMainThread): Deleted.
     234        (PlatformCALayer::collectRectsToPaint): Deleted.
     235        (PlatformCALayer::drawLayerContents): Deleted.
     236        (PlatformCALayer::frameForLayer): Deleted.
     237        (PlatformCALayerCocoa::createCompatibleLayer const): Deleted.
     238        (PlatformCALayerCocoa::enumerateRectsBeingDrawn): Deleted.
     239        (PlatformCALayerCocoa::backingStoreBytesPerPixel const): Deleted.
     240        (PlatformCALayerCocoa::avPlayerLayer const): Deleted.
     241        * platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm:
     242        (-[WebLightSystemBackdropLayer init]):
     243        (-[WebDarkSystemBackdropLayer init]):
     244        * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
     245        (-[WebTiledBackingLayer createTileController:]):
     246        (-[WebTiledBackingLayer setNeedsDisplayInRect:]):
     247        (-[WebTiledBackingLayer setBorderColor:]):
     248        * testing/Internals.cpp:
     249        (WebCore::Internals::Internals):
     250
    12512018-09-25  YUHAN WU  <yuhan_wu@apple.com>
    2252
  • trunk/Source/WebCore/Configurations/WebCore.xcconfig

    r233501 r236481  
    8787WK_DATA_DETECTORS_CORE_LDFLAGS_macosx = -framework DataDetectorsCore;
    8888
    89 WK_DEVICE_IDENTITY_LDFLAGS = $(WK_DEVICE_IDENTITY_LDFLAGS_$(WK_HAVE_DEVICE_IDENTITY));
    90 WK_DEVICE_IDENTITY_LDFLAGS_YES = -framework DeviceIdentity;
    91 
    9289WK_GRAPHICS_SERVICES_LDFLAGS = $(WK_GRAPHICS_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
    9390WK_GRAPHICS_SERVICES_LDFLAGS_cocoatouch = -framework GraphicsServices;
     
    130127
    131128// FIXME: Reduce the number of allowable_clients <rdar://problem/31823969>
    132 OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
     129OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
    133130
    134131OTHER_LDFLAGS_PLATFORM_cocoatouch = -allowable_client WebKit -allowable_client iTunesU -allowable_client Casablanca -allowable_client Remote -allowable_client TVBooks -allowable_client DumpRenderTree -allowable_client WebKitTestRunner -allowable_client TestWebKitAPI;
     
    189186TEXT_BASED_API_FILE = WebCore.tbd
    190187
    191 WK_HAVE_DEVICE_IDENTITY = $(WK_HAVE_DEVICE_IDENTITY_$(PLATFORM_NAME));
    192 WK_HAVE_DEVICE_IDENTITY_iphoneos = YES;
    193 
    194188WK_HAVE_URL_FORMATTING = $(WK_HAVE_URL_FORMATTING_$(WK_PLATFORM_NAME));
    195189WK_HAVE_URL_FORMATTING_iphoneos = $(WK_HAVE_URL_FORMATTING$(WK_IOS_12));
  • trunk/Source/WebCore/DerivedSources.make

    r236429 r236481  
    341341    $(WebCore)/Modules/webauthn/AuthenticatorAttestationResponse.idl \
    342342    $(WebCore)/Modules/webauthn/AuthenticatorResponse.idl \
     343    $(WebCore)/Modules/webauthn/AuthenticatorTransport.idl \
    343344    $(WebCore)/Modules/webauthn/PublicKeyCredential.idl \
    344         $(WebCore)/Modules/webauthn/PublicKeyCredentialCreationOptions.idl \
     345    $(WebCore)/Modules/webauthn/PublicKeyCredentialCreationOptions.idl \
    345346    $(WebCore)/Modules/webauthn/PublicKeyCredentialDescriptor.idl \
    346         $(WebCore)/Modules/webauthn/PublicKeyCredentialRequestOptions.idl \
     347    $(WebCore)/Modules/webauthn/PublicKeyCredentialRequestOptions.idl \
    347348    $(WebCore)/Modules/webauthn/PublicKeyCredentialType.idl \
    348349    $(WebCore)/Modules/webdatabase/DOMWindowWebDatabase.idl \
  • trunk/Source/WebCore/Modules/webauthn/AuthenticatorTransport.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include <wtf/EnumTraits.h>
    3231
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     32namespace WebCore {
     33
     34enum class AuthenticatorTransport {
     35    Usb,
     36    Nfc,
     37    Ble,
     38    Internal
     39};
     40
     41} // namespace WebCore
     42
     43namespace WTF {
     44
     45template<> struct EnumTraits<WebCore::AuthenticatorTransport> {
     46    using values = EnumValues<
     47        WebCore::AuthenticatorTransport,
     48        WebCore::AuthenticatorTransport::Usb,
     49        WebCore::AuthenticatorTransport::Nfc,
     50        WebCore::AuthenticatorTransport::Ble,
     51        WebCore::AuthenticatorTransport::Internal
     52    >;
     53};
     54
     55} // namespace WTF
     56
     57#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebCore/Modules/webauthn/AuthenticatorTransport.idl

    r236480 r236481  
    2929    "usb",
    3030    "nfc",
    31     "ble"
     31    "ble",
     32    "internal"
    3233};
    33 
    34 [
    35     Conditional=WEB_AUTHN,
    36 ] dictionary PublicKeyCredentialDescriptor {
    37     required PublicKeyCredentialType type;
    38     required BufferSource id;
    39     sequence<AuthenticatorTransport> transports;
    40 };
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h

    r235888 r236481  
    3232#include "PublicKeyCredentialType.h"
    3333#include <wtf/CrossThreadCopier.h>
     34#include <wtf/EnumTraits.h>
    3435#include <wtf/Forward.h>
    3536
     
    3738
    3839struct PublicKeyCredentialCreationOptions {
     40    enum class AuthenticatorAttachment {
     41        Platform,
     42        CrossPlatform
     43    };
     44
    3945    struct Entity {
    4046        String name;
     
    6066    };
    6167
     68    struct AuthenticatorSelectionCriteria {
     69        AuthenticatorAttachment authenticatorAttachment;
     70
     71        template<class Encoder> void encode(Encoder&) const;
     72        template<class Decoder> static std::optional<AuthenticatorSelectionCriteria> decode(Decoder&);
     73    };
     74
    6275    RpEntity rp;
    6376    UserEntity user;
     
    6881    std::optional<unsigned long> timeout;
    6982    Vector<PublicKeyCredentialDescriptor> excludeCredentials;
     83    std::optional<AuthenticatorSelectionCriteria> authenticatorSelection;
    7084
    7185    template<class Encoder> void encode(Encoder&) const;
     
    90104}
    91105
     106template<class Encoder>
     107void PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode(Encoder& encoder) const
     108{
     109    encoder << authenticatorAttachment;
     110}
     111
     112template<class Decoder>
     113std::optional<PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria> PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode(Decoder& decoder)
     114{
     115    PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria result;
     116    if (!decoder.decodeEnum(result.authenticatorAttachment))
     117        return std::nullopt;
     118    return result;
     119}
     120
    92121// Not every member is encoded.
    93122template<class Encoder>
     
    97126    encoder << static_cast<uint64_t>(user.id.length());
    98127    encoder.encodeFixedLengthData(user.id.data(), user.id.length(), 1);
    99     encoder << user.displayName << user.name << user.icon << pubKeyCredParams << excludeCredentials;
     128    encoder << user.displayName << user.name << user.icon << pubKeyCredParams << excludeCredentials << authenticatorSelection;
    100129}
    101130
     
    110139    if (!decoder.decode(result.rp.icon))
    111140        return std::nullopt;
    112 
    113     std::optional<uint64_t> userIdLength;
    114     decoder >> userIdLength;
    115     if (!userIdLength)
     141    if (!decoder.decode(result.user.idVector))
    116142        return std::nullopt;
    117     result.user.idVector.reserveCapacity(userIdLength.value());
    118     if (!decoder.decodeFixedLengthData(result.user.idVector.data(), userIdLength.value(), 1))
    119         return std::nullopt;
    120 
    121143    if (!decoder.decode(result.user.displayName))
    122144        return std::nullopt;
     
    129151    if (!decoder.decode(result.excludeCredentials))
    130152        return std::nullopt;
     153
     154    std::optional<std::optional<AuthenticatorSelectionCriteria>> authenticatorSelection;
     155    decoder >> authenticatorSelection;
     156    if (!authenticatorSelection)
     157        return std::nullopt;
     158    result.authenticatorSelection = WTFMove(authenticatorSelection.value());
     159
    131160    return result;
    132161}
     
    152181    }
    153182};
     183
     184template<> struct EnumTraits<WebCore::PublicKeyCredentialCreationOptions::AuthenticatorAttachment> {
     185    using values = EnumValues<
     186        WebCore::PublicKeyCredentialCreationOptions::AuthenticatorAttachment,
     187        WebCore::PublicKeyCredentialCreationOptions::AuthenticatorAttachment::Platform,
     188        WebCore::PublicKeyCredentialCreationOptions::AuthenticatorAttachment::CrossPlatform
     189    >;
     190};
     191
    154192} // namespace WTF
    155193
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.idl

    r227764 r236481  
    3737    unsigned long timeout;
    3838    sequence<PublicKeyCredentialDescriptor> excludeCredentials = [];
    39     // We don't allow RPs to select authenticators at this stage.
    40     // Hence, those options are always { "platform", true, "required" }.
    41     // AuthenticatorSelectionCriteria authenticatorSelection;
     39    AuthenticatorSelectionCriteria authenticatorSelection;
    4240    // Always "direct" for us.
    4341    // AttestationConveyancePreference attestation = "none";
     
    7270    required COSEAlgorithmIdentifier alg;
    7371};
     72
     73[
     74    Conditional=WEB_AUTHN,
     75] dictionary AuthenticatorSelectionCriteria {
     76    AuthenticatorAttachment      authenticatorAttachment;
     77    // We don't allow RPs to set the following values at this stage.
     78    // Hence, those options are always { true, "required" }.
     79    // boolean                      requireResidentKey = false;
     80    // UserVerificationRequirement  userVerification = "preferred";
     81};
     82
     83[
     84    Conditional=WEB_AUTHN,
     85] enum AuthenticatorAttachment {
     86    "platform",
     87    "cross-platform"
     88};
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialData.h

    r235888 r236481  
    5858void PublicKeyCredentialData::encode(Encoder& encoder) const
    5959{
     60    if (!rawId) {
     61        encoder << true;
     62        return;
     63    }
     64    encoder << false;
     65
    6066    encoder << static_cast<uint64_t>(rawId->byteLength());
    6167    encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(rawId->data()), rawId->byteLength(), 1);
     
    6369    encoder << isAuthenticatorAttestationResponse;
    6470
    65     if (isAuthenticatorAttestationResponse) {
     71    if (isAuthenticatorAttestationResponse && attestationObject) {
    6672        encoder << static_cast<uint64_t>(attestationObject->byteLength());
    6773        encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(attestationObject->data()), attestationObject->byteLength(), 1);
     
    6975    }
    7076
     77    if (!authenticatorData || !signature || !userHandle)
     78        return;
    7179    encoder << static_cast<uint64_t>(authenticatorData->byteLength());
    7280    encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(authenticatorData->data()), authenticatorData->byteLength(), 1);
     
    8189{
    8290    PublicKeyCredentialData result;
     91
     92    std::optional<bool> isEmpty;
     93    decoder >> isEmpty;
     94    if (!isEmpty)
     95        return std::nullopt;
     96    if (isEmpty.value())
     97        return result;
    8398
    8499    std::optional<uint64_t> rawIdLength;
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h

    r229699 r236481  
    2828#if ENABLE(WEB_AUTHN)
    2929
     30#include "AuthenticatorTransport.h"
    3031#include "BufferSource.h"
    3132#include "PublicKeyCredentialType.h"
    32 #include <wtf/EnumTraits.h>
    3333
    3434namespace WebCore {
    3535
    3636struct PublicKeyCredentialDescriptor {
    37     enum class AuthenticatorTransport {
    38         Usb,
    39         Nfc,
    40         Ble
    41     };
    42 
    4337    PublicKeyCredentialType type;
    4438    BufferSource id; // id becomes idVector once it is passed to UIProcess.
     
    5448{
    5549    encoder << type;
    56     Vector<uint8_t> idVector;
    57     idVector.append(id.data(), id.length());
    58     encoder << idVector << transports;
     50    encoder << static_cast<uint64_t>(id.length());
     51    encoder.encodeFixedLengthData(id.data(), id.length(), 1);
     52    encoder << transports;
    5953}
    6054
     
    7468} // namespace WebCore
    7569
    76 namespace WTF {
    77 
    78 template<> struct EnumTraits<WebCore::PublicKeyCredentialDescriptor::AuthenticatorTransport> {
    79     using values = EnumValues<
    80         WebCore::PublicKeyCredentialDescriptor::AuthenticatorTransport,
    81         WebCore::PublicKeyCredentialDescriptor::AuthenticatorTransport::Usb,
    82         WebCore::PublicKeyCredentialDescriptor::AuthenticatorTransport::Nfc,
    83         WebCore::PublicKeyCredentialDescriptor::AuthenticatorTransport::Ble
    84     >;
    85 };
    86 
    87 }
    88 
    8970#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl

    r227764 r236481  
    2626[
    2727    Conditional=WEB_AUTHN,
    28 ] enum AuthenticatorTransport {
    29     "usb",
    30     "nfc",
    31     "ble"
    32 };
    33 
    34 [
    35     Conditional=WEB_AUTHN,
    3628] dictionary PublicKeyCredentialDescriptor {
    3729    required PublicKeyCredentialType type;
  • trunk/Source/WebCore/PAL/ChangeLog

    r236468 r236481  
     12018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Make AuthenticatorManager
     4        https://bugs.webkit.org/show_bug.cgi?id=189279
     5        <rdar://problem/44116792>
     6
     7        Reviewed by Chris Dumez.
     8
     9        It moves linking to DeviceIdentity.framework to WebKit.
     10
     11        * PAL.xcodeproj/project.pbxproj:
     12
    1132018-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
    214
  • trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj

    r236468 r236481  
    114114                570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; };
    115115                570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */; };
    116                 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */; };
    117116                7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; };
    118117                7A3A6A8020CADB4700317AAE /* NSImageSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */; };
     
    269268                570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxySPI.h; sourceTree = "<group>"; };
    270269                570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSXPCConnectionSPI.h; sourceTree = "<group>"; };
    271                 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceIdentitySPI.h; sourceTree = "<group>"; };
    272270                7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; };
    273271                7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSImageSPI.h; sourceTree = "<group>"; };
     
    377375                                0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */,
    378376                                0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */,
    379                                 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */,
    380377                                CE5673862151A7B9002F92D7 /* IOKitSPI.h */,
    381378                                0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */,
     
    666663                                0C5AF91A1F43A4C7002EAC02 /* DataDetectorsUISPI.h in Headers */,
    667664                                A1175B571F6B470500C4B9F0 /* DefaultSearchProvider.h in Headers */,
    668                                 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */,
    669665                                0C2D9E731EEF5AF600DBC317 /* ExportMacros.h in Headers */,
    670666                                F44291601FA5261E002CC93E /* FileSizeFormatter.h in Headers */,
  • trunk/Source/WebCore/Sources.txt

    r236429 r236481  
    24292429JSAuthenticatorAttestationResponse.cpp
    24302430JSAuthenticatorResponse.cpp
     2431JSAuthenticatorTransport.cpp
    24312432JSBarProp.cpp
    24322433JSBasicCredential.cpp
  • trunk/Source/WebCore/SourcesCocoa.txt

    r236445 r236481  
    2626Modules/plugins/QuickTimePluginReplacement.mm
    2727Modules/plugins/YouTubePluginReplacement.cpp
    28 Modules/webauthn/cocoa/LocalAuthenticator.mm
    2928Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm
    3029
     
    197196platform/cocoa/KeyEventCocoa.mm
    198197platform/cocoa/LocalizedStringsCocoa.mm
    199 platform/cocoa/LocalAuthenticationSoftLink.mm
    200198platform/cocoa/MIMETypeRegistryCocoa.mm
    201199platform/cocoa/NetworkExtensionContentFilter.mm
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r236445 r236481  
    17381738                571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; };
    17391739                572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */; };
    1740                 57212152205365650062AA1F /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721214E20535D710062AA1F /* LocalAuthenticationSoftLink.h */; };
    17411740                5721A9871ECE53B10081295A /* CryptoDigestAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9861ECE53B10081295A /* CryptoDigestAlgorithm.h */; };
    17421741                5721A98B1ECE57040081295A /* CryptoAlgorithmRsaPssParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9881ECE57040081295A /* CryptoAlgorithmRsaPssParams.h */; };
     
    17631762                573489391DAC6B6E00DC0667 /* CryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 573489381DAC6B6D00DC0667 /* CryptoAlgorithmParameters.h */; };
    17641763                5739E12F1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5739E12E1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h */; };
    1765                 574F55E0204F3ACE002948C6 /* LocalAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 574F55DE204F3744002948C6 /* LocalAuthenticator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17661764                574F55E1204F3B23002948C6 /* COSEConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 574F55DC204F3732002948C6 /* COSEConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17671765                5750A9751E68D00000705C4A /* CryptoKeyEC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9731E68D00000705C4A /* CryptoKeyEC.h */; };
     
    17971795                57DCED69214077640016B847 /* JSMockAuthenticatorCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */; };
    17981796                57DCED74214305F00016B847 /* PublicKeyCredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED72214305F00016B847 /* PublicKeyCredentialData.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1797                57DCED9021487FF70016B847 /* AuthenticatorTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1798                57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED92214880C60016B847 /* JSAuthenticatorTransport.h */; };
    17991799                57E1E5A31E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E1E5A11E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h */; };
    18001800                57E1E5A71E8DBD3E00EE37C9 /* CryptoAlgorithmAesCtrParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E1E5A61E8DBD3E00EE37C9 /* CryptoAlgorithmAesCtrParams.h */; };
     
    84958495                572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesCbcCfbParams.idl; sourceTree = "<group>"; };
    84968496                572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesCbcCfbParams.h; sourceTree = "<group>"; };
    8497                 5721214E20535D710062AA1F /* LocalAuthenticationSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSoftLink.h; sourceTree = "<group>"; };
    8498                 57212150205361D20062AA1F /* LocalAuthenticationSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticationSoftLink.mm; sourceTree = "<group>"; };
    84998497                5721A9831ECE4FB90081295A /* CryptoAlgorithmRSA_PSSMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_PSSMac.cpp; sourceTree = "<group>"; };
    85008498                5721A9861ECE53B10081295A /* CryptoDigestAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoDigestAlgorithm.h; sourceTree = "<group>"; };
     
    85468544                574D42791D594FF6002CF50E /* GlobalCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GlobalCrypto.idl; sourceTree = "<group>"; };
    85478545                574F55DC204F3732002948C6 /* COSEConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COSEConstants.h; sourceTree = "<group>"; };
    8548                 574F55DE204F3744002948C6 /* LocalAuthenticator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticator.h; sourceTree = "<group>"; };
    8549                 574F55DF204F3744002948C6 /* LocalAuthenticator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticator.mm; sourceTree = "<group>"; };
    85508546                574F55E2204F3CBF002948C6 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
    85518547                5750A9721E68D00000705C4A /* CryptoKeyEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyEC.cpp; sourceTree = "<group>"; };
     
    86238619                57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockAuthenticatorCoordinator.cpp; sourceTree = "<group>"; };
    86248620                57DCED72214305F00016B847 /* PublicKeyCredentialData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PublicKeyCredentialData.h; sourceTree = "<group>"; };
     8621                57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorTransport.h; sourceTree = "<group>"; };
     8622                57DCED8E21487EDB0016B847 /* AuthenticatorTransport.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AuthenticatorTransport.idl; sourceTree = "<group>"; };
     8623                57DCED91214880C60016B847 /* JSAuthenticatorTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAuthenticatorTransport.cpp; sourceTree = "<group>"; };
     8624                57DCED92214880C60016B847 /* JSAuthenticatorTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAuthenticatorTransport.h; sourceTree = "<group>"; };
    86258625                57E1E5A01E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CTR.cpp; sourceTree = "<group>"; };
    86268626                57E1E5A11E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAES_CTR.h; sourceTree = "<group>"; };
     
    1883718837                                57303BCF20087A8300355965 /* AuthenticatorResponse.h */,
    1883818838                                57303BD120087A8300355965 /* AuthenticatorResponse.idl */,
     18839                                57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */,
     18840                                57DCED8E21487EDB0016B847 /* AuthenticatorTransport.idl */,
    1883918841                                574F55DC204F3732002948C6 /* COSEConstants.h */,
    1884018842                                57D8462C1FEAF68F00CA3682 /* PublicKeyCredential.cpp */,
     
    1886318865                                57303BDE20095B2700355965 /* JSAuthenticatorResponse.cpp */,
    1886418866                                57303BDD20095B2600355965 /* JSAuthenticatorResponse.h */,
     18867                                57DCED91214880C60016B847 /* JSAuthenticatorTransport.cpp */,
     18868                                57DCED92214880C60016B847 /* JSAuthenticatorTransport.h */,
    1886518869                                57D846311FEAFC2F00CA3682 /* JSPublicKeyCredential.cpp */,
    1886618870                                57D846301FEAFC2F00CA3682 /* JSPublicKeyCredential.h */,
     
    2169321697                                A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */,
    2169421698                                A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */,
    21695                                 5721214E20535D710062AA1F /* LocalAuthenticationSoftLink.h */,
    21696                                 57212150205361D20062AA1F /* LocalAuthenticationSoftLink.mm */,
    2169721699                                1A4832B21A953BA6008B4DFE /* LocalizedStringsCocoa.mm */,
    2169821700                                C53D39331C97892D007F3AE9 /* MIMETypeRegistryCocoa.mm */,
     
    2730527307                                5760827220215A5500116678 /* AuthenticatorCoordinatorClient.h in Headers */,
    2730627308                                57303BD220087A8300355965 /* AuthenticatorResponse.h in Headers */,
     27309                                57DCED9021487FF70016B847 /* AuthenticatorTransport.h in Headers */,
    2730727310                                A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */,
    2730827311                                A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */,
     
    2858328586                                57303C222009AF0300355965 /* JSAuthenticatorAttestationResponse.h in Headers */,
    2858428587                                57303BE120095D6100355965 /* JSAuthenticatorResponse.h in Headers */,
     28588                                57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */,
    2858528589                                BC124F000C26447A009E2349 /* JSBarProp.h in Headers */,
    2858628590                                57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */,
     
    2945729461                                51E6821016387302003BBF3C /* LoaderStrategy.h in Headers */,
    2945829462                                8A12E35D11FA33280025836A /* LoadTiming.h in Headers */,
    29459                                 57212152205365650062AA1F /* LocalAuthenticationSoftLink.h in Headers */,
    29460                                 574F55E0204F3ACE002948C6 /* LocalAuthenticator.h in Headers */,
    2946129463                                06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */,
    2946229464                                445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */,
  • trunk/Source/WebCore/dom/ExceptionData.h

    r221198 r236481  
    3535    String message;
    3636
    37     ExceptionData isolatedCopy() const;
     37    WEBCORE_EXPORT ExceptionData isolatedCopy() const;
    3838
    3939    template<class Encoder> void encode(Encoder&) const;
  • trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm

    r232501 r236481  
    3232#include <wtf/MainThread.h>
    3333
    34 using namespace WebCore;
    35 
    3634@interface WebCoreSharedBufferData : NSData
    3735{
    38     RefPtr<const SharedBuffer::DataSegment> sharedBufferDataSegment;
     36    RefPtr<const WebCore::SharedBuffer::DataSegment> sharedBufferDataSegment;
    3937}
    4038
    41 - (id)initWithSharedBufferDataSegment:(const SharedBuffer::DataSegment&)dataSegment;
     39- (id)initWithSharedBufferDataSegment:(const WebCore::SharedBuffer::DataSegment&)dataSegment;
    4240@end
    4341
     
    6058}
    6159
    62 - (id)initWithSharedBufferDataSegment:(const SharedBuffer::DataSegment&)dataSegment
     60- (id)initWithSharedBufferDataSegment:(const WebCore::SharedBuffer::DataSegment&)dataSegment
    6361{
    6462    self = [super init];
  • trunk/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm

    r236088 r236481  
    4646#import <wtf/SoftLinking.h>
    4747
    48 using namespace WebCore;
     48namespace WebCore {
    4949
    5050VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement()
     
    275275}
    276276
     277} // namespace WebCore
     278
    277279#endif
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm

    r226976 r236481  
    3434#import <wtf/text/WTFString.h>
    3535
    36 using namespace WebCore;
     36namespace WebCore {
    3737
    3838static NSString * const WKExplicitBeginTimeFlag = @"WKPlatformCAAnimationExplicitBeginTimeFlag";
    3939
    40 bool WebCore::hasExplicitBeginTime(CAAnimation *animation)
     40bool hasExplicitBeginTime(CAAnimation *animation)
    4141{
    4242    return [[animation valueForKey:WKExplicitBeginTimeFlag] boolValue];
    4343}
    4444
    45 void WebCore::setHasExplicitBeginTime(CAAnimation *animation, bool value)
     45void setHasExplicitBeginTime(CAAnimation *animation, bool value)
    4646{
    4747    [animation setValue:[NSNumber numberWithBool:value] forKey:WKExplicitBeginTimeFlag];
    4848}
    4949   
    50 NSString* WebCore::toCAFillModeType(PlatformCAAnimation::FillModeType type)
     50NSString* toCAFillModeType(PlatformCAAnimation::FillModeType type)
    5151{
    5252    switch (type) {
     
    7070}
    7171
    72 NSString* WebCore::toCAValueFunctionType(PlatformCAAnimation::ValueFunctionType type)
     72NSString* toCAValueFunctionType(PlatformCAAnimation::ValueFunctionType type)
    7373{
    7474    switch (type) {
     
    127127}
    128128
    129 CAMediaTimingFunction* WebCore::toCAMediaTimingFunction(const TimingFunction* timingFunction, bool reverse)
     129CAMediaTimingFunction* toCAMediaTimingFunction(const TimingFunction* timingFunction, bool reverse)
    130130{
    131131    ASSERT(timingFunction);
     
    379379}
    380380
    381 void PlatformCAAnimationCocoa::setFromValue(const WebCore::TransformationMatrix& value)
     381void PlatformCAAnimationCocoa::setFromValue(const TransformationMatrix& value)
    382382{
    383383    if (!isBasicAnimation())
     
    400400}
    401401
    402 void PlatformCAAnimationCocoa::setFromValue(const WebCore::Color& value)
     402void PlatformCAAnimationCocoa::setFromValue(const Color& value)
    403403{
    404404    if (!isBasicAnimation())
     
    436436}
    437437
    438 void PlatformCAAnimationCocoa::setToValue(const WebCore::TransformationMatrix& value)
     438void PlatformCAAnimationCocoa::setToValue(const TransformationMatrix& value)
    439439{
    440440    if (!isBasicAnimation())
     
    457457}
    458458
    459 void PlatformCAAnimationCocoa::setToValue(const WebCore::Color& value)
     459void PlatformCAAnimationCocoa::setToValue(const Color& value)
    460460{
    461461    if (!isBasicAnimation())
     
    499499}
    500500
    501 void PlatformCAAnimationCocoa::setValues(const Vector<WebCore::TransformationMatrix>& value)
     501void PlatformCAAnimationCocoa::setValues(const Vector<TransformationMatrix>& value)
    502502{
    503503    if (animationType() != Keyframe)
     
    530530}
    531531
    532 void PlatformCAAnimationCocoa::setValues(const Vector<WebCore::Color>& value)
     532void PlatformCAAnimationCocoa::setValues(const Vector<Color>& value)
    533533{
    534534    if (animationType() != Keyframe)
     
    603603    [static_cast<CAKeyframeAnimation*>(m_animation.get()) setTimingFunctions:[other timingFunctions]];
    604604}
     605
     606} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm

    r235586 r236481  
    3434#import <wtf/BlockObjCExceptions.h>
    3535
    36 using namespace WebCore;
     36namespace WebCore {
    3737
    3838// FIXME: Should share these values with CSSFilter::build() (https://bugs.webkit.org/show_bug.cgi?id=76008).
     
    693693#endif
    694694}
     695
     696} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm

    r235935 r236481  
    6767SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVPlayerLayer)
    6868
    69 using namespace WebCore;
     69namespace WebCore {
    7070
    7171Ref<PlatformCALayer> PlatformCALayerCocoa::create(LayerType layerType, PlatformCALayerClient* owner)
     
    9898}
    9999
     100} // namespace WebCore
     101
    100102// Delegate for animationDidStart callback
    101103@interface WebAnimationDelegate : NSObject {
    102     PlatformCALayer* m_owner;
     104    WebCore::PlatformCALayer* m_owner;
    103105}
    104106
    105107- (void)animationDidStart:(CAAnimation *)anim;
    106 - (void)setOwner:(PlatformCALayer*)owner;
     108- (void)setOwner:(WebCore::PlatformCALayer*)owner;
    107109
    108110@end
     
    112114- (void)animationDidStart:(CAAnimation *)animation
    113115{
     116    using namespace WebCore;
    114117#if PLATFORM(IOS)
    115118    WebThreadLock();
     
    142145- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished
    143146{
     147    using namespace WebCore;
    144148#if PLATFORM(IOS)
    145149    WebThreadLock();
     
    164168}
    165169
    166 - (void)setOwner:(PlatformCALayer*)owner
     170- (void)setOwner:(WebCore::PlatformCALayer*)owner
    167171{
    168172    m_owner = owner;
     
    170174
    171175@end
     176
     177namespace WebCore {
    172178
    173179void PlatformCALayerCocoa::setOwner(PlatformCALayerClient* owner)
     
    12631269    return nil;
    12641270}
     1271
     1272} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm

    r192712 r236481  
    3030#import <QuartzCore/QuartzCore.h>
    3131
    32 using namespace WebCore;
    33 
    3432// FIXME: https://bugs.webkit.org/show_bug.cgi?id=146250
    3533// These should provide the system recipes for the layers
     
    5250
    5351    CGFloat components[4] = { 0.8, 0.8, 0.8, 0.8 };
    54     [super setBackgroundColor:adoptCF(CGColorCreate(sRGBColorSpaceRef(), components)).get()];
     52    [super setBackgroundColor:adoptCF(CGColorCreate(WebCore::sRGBColorSpaceRef(), components)).get()];
    5553
    5654    return self;
     
    7876
    7977    CGFloat components[4] = { 0.2, 0.2, 0.2, 0.8 };
    80     [super setBackgroundColor:adoptCF(CGColorCreate(sRGBColorSpaceRef(), components)).get()];
     78    [super setBackgroundColor:adoptCF(CGColorCreate(WebCore::sRGBColorSpaceRef(), components)).get()];
    8179
    8280    return self;
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm

    r212776 r236481  
    3131#import <wtf/MainThread.h>
    3232
    33 using namespace WebCore;
    34 
    3533@implementation WebTiledBackingLayer
    3634
     
    6260}
    6361
    64 - (TileController*)createTileController:(PlatformCALayer*)rootLayer
     62- (WebCore::TileController*)createTileController:(WebCore::PlatformCALayer*)rootLayer
    6563{
    6664    ASSERT(!_tileController);
     
    10199- (void)setNeedsDisplayInRect:(CGRect)rect
    102100{
    103     _tileController->setNeedsDisplayInRect(enclosingIntRect(rect));
     101    _tileController->setNeedsDisplayInRect(WebCore::enclosingIntRect(rect));
    104102}
    105103
     
    158156- (void)setBorderColor:(CGColorRef)borderColor
    159157{
    160     _tileController->setTileDebugBorderColor(Color(borderColor));
     158    _tileController->setTileDebugBorderColor(WebCore::Color(borderColor));
    161159}
    162160
  • trunk/Source/WebCore/testing/Internals.cpp

    r236448 r236481  
    556556
    557557#if ENABLE(WEB_AUTHN)
     558    // FIXME(189283)
    558559    if (document.page()) {
    559560        auto mockAuthenticatorCoordinator = std::make_unique<MockAuthenticatorCoordinator>();
    560561        m_mockAuthenticatorCoordinator = makeWeakPtr(mockAuthenticatorCoordinator.get());
    561         document.page()->authenticatorCoordinator().setClient(WTFMove(mockAuthenticatorCoordinator));
     562//        document.page()->authenticatorCoordinator().setClient(WTFMove(mockAuthenticatorCoordinator));
    562563    }
    563564#endif
  • trunk/Source/WebKit/CMakeLists.txt

    r236477 r236481  
    5252    "${WEBKIT_DIR}/UIProcess/Storage"
    5353    "${WEBKIT_DIR}/UIProcess/UserContent"
     54    "${WEBKIT_DIR}/UIProcess/WebAuthentication"
     55    "${WEBKIT_DIR}/UIProcess/WebAuthentication/Mock"
    5456    "${WEBKIT_DIR}/UIProcess/WebStorage"
    5557    "${WEBKIT_DIR}/UIProcess/WebsiteData"
  • trunk/Source/WebKit/ChangeLog

    r236480 r236481  
     12018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Make AuthenticatorManager
     4        https://bugs.webkit.org/show_bug.cgi?id=189279
     5        <rdar://problem/44116792>
     6
     7        Reviewed by Chris Dumez.
     8
     9        This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles
     10        web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI.
     11        The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton
     12        per UI Process.
     13
     14        1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will
     15        then distribute requests whenever a new authenticator is discovered.
     16
     17        2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke
     18        startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService
     19        is the one that discover attached platform authenticators, for example, TouchID or FaceID.
     20
     21        Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB,
     22        NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to
     23        *Service, so the latter can inform the former whenever an authenticator is added or removed.
     24
     25        When a new authenticator is discovered, the corresponding service will create an Authetnicator object that
     26        binds to the physical authenticator device through a *Connection object. There is no ABC for connection for
     27        now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive
     28        messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators
     29        are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's
     30        request handling process. So we can override them in a mock test environment. I will talk about this in the
     31        next section.
     32
     33        3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests
     34        will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that
     35        works asynchronously.
     36
     37        For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End,
     38        and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to
     39        UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID
     40        or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to
     41        DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator
     42        implementation, and this patch converts it to a FSM and simplify the callback and threading model.
     43
     44        When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager.
     45        AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise,
     46        the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642.
     47
     48        The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here:
     49        1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in
     50        the interface of the ABC.
     51        2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated
     52        thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback
     53        into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence,
     54        weak pointers in the actual callback are guaranteed to work.
     55        3) Callbacks are used only if it is one way, and they are CompletionHandlers.
     56        4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces.
     57
     58        Finally, let me explain how the mock test works:
     59        1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess
     60        instead of WebProcess, says, the AuthenticatorManager.
     61        2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best
     62        possible coverage in auto tests.
     63        3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is
     64        provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object.
     65        4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error.
     66        5) Also, Mock*Service classes are made to mock the discovery process as well.
     67        6) Noted, every mock overrided methods are made thin.
     68
     69        * CMakeLists.txt:
     70        * Configurations/WebKit.xcconfig:
     71        * Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     72        * SourcesCocoa.txt:
     73        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
     74        (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
     75        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
     76        * UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     77        (WebKit::Authenticator::handleRequest):
     78        (WebKit::Authenticator::receiveRespond const):
     79        * UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h.
     80        (WebKit::Authenticator::setObserver):
     81        (WebKit::Authenticator::observer const):
     82        (WebKit::Authenticator::requestData const):
     83        * UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added.
     84        (WebKit::AuthenticatorManagerInternal::collectTransports):
     85        (WebKit::AuthenticatorManager::makeCredential):
     86        (WebKit::AuthenticatorManager::getAssertion):
     87        (WebKit::AuthenticatorManager::clearState):
     88        (WebKit::AuthenticatorManager::authenticatorAdded):
     89        (WebKit::AuthenticatorManager::respondReceived):
     90        (WebKit::AuthenticatorManager::createService const):
     91        (WebKit::AuthenticatorManager::respondReceivedInternal):
     92        (WebKit::AuthenticatorManager::startDiscovery):
     93        * UIProcess/WebAuthentication/AuthenticatorManager.h: Added.
     94        (WebKit::AuthenticatorManager::pendingCompletionHandler):
     95        * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     96        (WebKit::AuthenticatorTransportService::create):
     97        (WebKit::AuthenticatorTransportService::createMock):
     98        (WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
     99        (WebKit::AuthenticatorTransportService::startDiscovery const):
     100        * UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     101        (WebKit::AuthenticatorTransportService::observer const):
     102        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     103        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     104        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added.
     105        (WebKit::LocalAuthenticatorInternal::buildAuthData):
     106        (WebKit::LocalAuthenticatorInternal::transportsContain):
     107        (WebKit::LocalAuthenticatorInternal::produceHashSet):
     108        (WebKit::LocalAuthenticatorInternal::toVector):
     109        (WebKit::LocalAuthenticator::LocalAuthenticator):
     110        (WebKit::LocalAuthenticator::makeCredential):
     111        (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
     112        (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
     113        (WebKit::LocalAuthenticator::getAssertion):
     114        (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
     115        * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     116        * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added.
     117        (WebKit::LocalConnection::getUserConsent const):
     118        (WebKit::LocalConnection::getAttestation const):
     119        * UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     120        * UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
     121        (WebKit::LocalService::LocalService):
     122        (WebKit::LocalService::isAvailable):
     123        (WebKit::LocalService::startDiscoveryInternal const):
     124        (WebKit::LocalService::platformStartDiscovery const):
     125        (WebKit::LocalService::createLocalConnection const):
     126        * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     127        (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
     128        (WebKit::MockAuthenticatorManager::createService const):
     129        (WebKit::MockAuthenticatorManager::respondReceivedInternal):
     130        * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     131        * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     132        * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added.
     133        (WebKit::MockLocalConnection::MockLocalConnection):
     134        (WebKit::MockLocalConnection::getUserConsent const):
     135        (WebKit::MockLocalConnection::getAttestation const):
     136        * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     137        (WebKit::MockLocalService::MockLocalService):
     138        (WebKit::MockLocalService::platformStartDiscovery const):
     139        (WebKit::MockLocalService::createLocalConnection const):
     140        * UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     141        * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     142        * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
     143        * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
     144        (WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
     145        (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
     146        (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
     147        (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
     148        (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted.
     149        * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
     150        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     151        (WebKit::WebsiteDataStore::WebsiteDataStore):
     152        (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
     153        * UIProcess/WebsiteData/WebsiteDataStore.h:
     154        (WebKit::WebsiteDataStore::authenticatorManager):
     155        * WebKit.xcodeproj/project.pbxproj:
     156
    11572018-09-25  Chris Dumez  <cdumez@apple.com>
    2158
  • trunk/Source/WebKit/Configurations/WebKit.xcconfig

    r236098 r236481  
    6363WK_CORE_SERVICES_LDFLAGS_macosx = -framework CoreServices;
    6464
     65WK_DEVICE_IDENTITY_LDFLAGS = $(WK_DEVICE_IDENTITY_LDFLAGS_$(WK_HAVE_DEVICE_IDENTITY));
     66WK_DEVICE_IDENTITY_LDFLAGS_YES = -framework DeviceIdentity;
     67
    6568WK_GRAPHICS_SERVICES_LDFLAGS = $(WK_GRAPHICS_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH));
    6669WK_GRAPHICS_SERVICES_LDFLAGS_cocoatouch = -framework GraphicsServices;
     
    119122WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
    120123
    121 FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
     124FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
    122125
    123126// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
     
    156159WK_RELOCATABLE_FRAMEWORK_LDFLAGS_YES = -Wl,-not_for_dyld_shared_cache;
    157160
     161WK_HAVE_DEVICE_IDENTITY = $(WK_HAVE_DEVICE_IDENTITY_$(PLATFORM_NAME));
     162WK_HAVE_DEVICE_IDENTITY_iphoneos = YES;
     163
    158164WK_HAVE_URL_FORMATTING = $(WK_HAVE_URL_FORMATTING_$(WK_PLATFORM_NAME));
    159165WK_HAVE_URL_FORMATTING_iphoneos = $(WK_HAVE_URL_FORMATTING$(WK_IOS_12));
  • trunk/Source/WebKit/SourcesCocoa.txt

    r236075 r236481  
    456456UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
    457457
     458UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
     459UIProcess/WebAuthentication/Cocoa/LocalConnection.mm
     460UIProcess/WebAuthentication/Cocoa/LocalService.mm
     461
     462UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
     463UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
     464UIProcess/WebAuthentication/Mock/MockLocalService.cpp
     465
     466UIProcess/WebAuthentication/AuthenticatorManager.cpp
     467UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
     468UIProcess/WebAuthentication/Authenticator.cpp
    458469UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp
    459470
  • trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp

    r236320 r236481  
    2929#include "APIArray.h"
    3030#include "APIWebsiteDataStore.h"
     31#include "MockWebAuthenticationConfiguration.h"
    3132#include "WKAPICast.h"
     33#include "WKDictionary.h"
     34#include "WKNumber.h"
     35#include "WKRetainPtr.h"
    3236#include "WKSecurityOriginRef.h"
    3337#include "WKString.h"
     
    567571    WebKit::toImpl(dataStoreRef)->websiteDataStore().setServiceWorkerRegistrationDirectory(WebKit::toImpl(serviceWorkerRegistrationDirectory)->string());
    568572}
     573
     574
     575void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configurationRef)
     576{
     577#if ENABLE(WEB_AUTHN)
     578    auto localRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Local")).get()));
     579
     580    MockWebAuthenticationConfiguration configuration;
     581    configuration.local.acceptAuthentication = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication")).get())));
     582    configuration.local.acceptAttestation = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation")).get())));
     583    configuration.local.privateKeyBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")).get())))->string();
     584
     585    WebKit::toImpl(dataStoreRef)->websiteDataStore().setMockWebAuthenticationConfiguration(WTFMove(configuration));
     586#endif
     587}
  • trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h

    r236216 r236481  
    115115WK_EXPORT void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef, WKStringRef serviceWorkerRegistrationDirectory);
    116116
     117WK_EXPORT void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configuration);
     118
    117119#ifdef __cplusplus
    118120}
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Authenticator.cpp

    r236480 r236481  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "Authenticator.h"
    2728
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     29#if ENABLE(WEB_AUTHN)
    3030
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     31#include <wtf/RunLoop.h>
    3232
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     33namespace WebKit {
     34
     35void Authenticator::handleRequest(const WebAuthenticationRequestData& data)
     36{
     37    m_pendingRequestData = data;
     38    // Enforce asynchronous execution of makeCredential/getAssertion.
     39    RunLoop::main().dispatch([weakThis = makeWeakPtr(*this)] {
     40        if (!weakThis)
     41            return;
     42        if (weakThis->m_pendingRequestData.isCreationRequest)
     43            weakThis->makeCredential();
     44        else
     45            weakThis->getAssertion();
     46    });
     47}
     48
     49void Authenticator::receiveRespond(Respond&& respond) const
     50{
     51    ASSERT(RunLoop::isMain());
     52    if (!m_observer)
     53        return;
     54    m_observer->respondReceived(WTFMove(respond));
     55}
     56
     57} // namespace WebKit
     58
     59#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Authenticator.h

    r236480 r236481  
    2828#if ENABLE(WEB_AUTHN)
    2929
     30#include "WebAuthenticationRequestData.h"
     31#include <WebCore/ExceptionData.h>
     32#include <WebCore/PublicKeyCredentialData.h>
    3033#include <wtf/Forward.h>
    31 #include <wtf/Noncopyable.h>
     34#include <wtf/RefCounted.h>
    3235#include <wtf/WeakPtr.h>
    3336
    34 namespace WebCore {
     37namespace WebKit {
    3538
    36 struct ExceptionData;
    37 struct PublicKeyCredentialCreationOptions;
    38 struct PublicKeyCredentialData;
    39 struct PublicKeyCredentialRequestOptions;
     39class Authenticator : public RefCounted<Authenticator>, public CanMakeWeakPtr<Authenticator> {
     40public:
     41    using Respond = Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>;
    4042
    41 using Callback = Function<void(Variant<PublicKeyCredentialData, ExceptionData>&&)>;
     43    class Observer : public CanMakeWeakPtr<Observer> {
     44    public:
     45        virtual ~Observer() = default;
     46        virtual void respondReceived(Respond&&) = 0;
     47    };
    4248
    43 typedef void (^CompletionBlock)(SecKeyRef _Nullable referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     49    virtual ~Authenticator() = default;
    4450
    45 // FIXME(182769): LocalAuthenticator should belongs to WebKit. However, we need unit tests.
    46 class WEBCORE_EXPORT LocalAuthenticator : public CanMakeWeakPtr<LocalAuthenticator> {
    47     WTF_MAKE_NONCOPYABLE(LocalAuthenticator);
    48 public:
    49     LocalAuthenticator();
    50     virtual ~LocalAuthenticator() = default;
     51    void setObserver(Observer& observer) { m_observer = makeWeakPtr(observer); }
    5152
    52     void makeCredential(const Vector<uint8_t>& hash, const PublicKeyCredentialCreationOptions&, Callback&&);
    53     void getAssertion(const Vector<uint8_t>& hash, const PublicKeyCredentialRequestOptions&, Callback&&);
    54     bool isAvailable() const;
     53    // This operation is guaranteed to execute asynchronously.
     54    void handleRequest(const WebAuthenticationRequestData&);
    5555
    5656protected:
    57     // Apple Attestation is moved into this virtual method such that it can be overrided by self attestation for testing.
    58     virtual void issueClientCertificate(const String& rpId, const String& username, const Vector<uint8_t>& hash, CompletionBlock _Nonnull) const;
     57    Authenticator() = default;
     58
     59    Observer* observer() const { return m_observer.get(); }
     60    const WebAuthenticationRequestData& requestData() const { return m_pendingRequestData; }
     61
     62    void receiveRespond(Respond&&) const;
     63
     64private:
     65    virtual void makeCredential() = 0;
     66    virtual void getAssertion() = 0;
     67
     68    WeakPtr<Observer> m_observer;
     69    WebAuthenticationRequestData m_pendingRequestData;
    5970};
    6071
    61 } // namespace WebCore
     72} // namespace WebKit
    6273
    6374#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp

    r236480 r236481  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "AuthenticatorTransportService.h"
    2728
    2829#if ENABLE(WEB_AUTHN)
    2930
    30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     31#include "LocalService.h"
     32#include "MockLocalService.h"
     33#include <wtf/RunLoop.h>
    3134
    32 #if USE(APPLE_INTERNAL_SDK)
     35namespace WebKit {
    3336
    34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300
    35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    36 #endif
    37 
    38 extern "C" {
    39 #import <DeviceIdentity/DeviceIdentity.h>
     37UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::create(WebCore::AuthenticatorTransport transport, Observer& observer)
     38{
     39    ASSERT(transport == WebCore::AuthenticatorTransport::Internal);
     40    return makeUniqueRef<LocalService>(observer);
    4041}
    4142
    42 #else
     43UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::createMock(WebCore::AuthenticatorTransport transport, Observer& observer, const MockWebAuthenticationConfiguration& configuration)
     44{
     45    ASSERT(transport == WebCore::AuthenticatorTransport::Internal);
     46    return makeUniqueRef<MockLocalService>(observer, configuration);
     47}
    4348
    44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     49AuthenticatorTransportService::AuthenticatorTransportService(Observer& observer)
     50    : m_observer(makeWeakPtr(observer))
     51{
     52}
    4553
    46 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    47 extern NSString * _Nonnull const kMAOptionsBAAIgnoreExistingKeychainItems;
    48 extern NSString * _Nonnull const kMAOptionsBAAKeychainAccessGroup;
    49 extern NSString * _Nonnull const kMAOptionsBAAKeychainLabel;
    50 extern NSString * _Nonnull const kMAOptionsBAANonce;
    51 extern NSString * _Nonnull const kMAOptionsBAAOIDNonce;
    52 extern NSString * _Nonnull const kMAOptionsBAAOIDSToInclude;
    53 extern NSString * _Nonnull const kMAOptionsBAASCRTAttestation;
    54 extern NSString * _Nonnull const kMAOptionsBAAValidity;
     54void AuthenticatorTransportService::startDiscovery() const
     55{
     56    // Enforce asynchronous execution of makeCredential.
     57    RunLoop::main().dispatch([weakThis = makeWeakPtr(*this)] {
     58        if (!weakThis)
     59            return;
     60        weakThis->startDiscoveryInternal();
     61    });
     62}
    5563
    56 extern "C"
    57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull);
    58 
    59 #endif // USE(APPLE_INTERNAL_SDK)
    60 
    61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     64} // namespace WebKit
    6265
    6366#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h

    r236480 r236481  
    2828#if ENABLE(WEB_AUTHN)
    2929
    30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     30#include <WebCore/AuthenticatorTransport.h>
     31#include <wtf/UniqueRef.h>
     32#include <wtf/WeakPtr.h>
    3133
    32 #if USE(APPLE_INTERNAL_SDK)
     34namespace WebKit {
    3335
    34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300
    35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    36 #endif
     36class Authenticator;
    3737
    38 extern "C" {
    39 #import <DeviceIdentity/DeviceIdentity.h>
    40 }
     38struct MockWebAuthenticationConfiguration;
    4139
    42 #else
     40class AuthenticatorTransportService : public CanMakeWeakPtr<AuthenticatorTransportService> {
     41    WTF_MAKE_FAST_ALLOCATED;
     42    WTF_MAKE_NONCOPYABLE(AuthenticatorTransportService);
     43public:
     44    class Observer : public CanMakeWeakPtr<Observer> {
     45    public:
     46        virtual ~Observer() = default;
    4347
    44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     48        virtual void authenticatorAdded(Ref<Authenticator>&&) = 0;
     49    };
    4550
    46 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    47 extern NSString * _Nonnull const kMAOptionsBAAIgnoreExistingKeychainItems;
    48 extern NSString * _Nonnull const kMAOptionsBAAKeychainAccessGroup;
    49 extern NSString * _Nonnull const kMAOptionsBAAKeychainLabel;
    50 extern NSString * _Nonnull const kMAOptionsBAANonce;
    51 extern NSString * _Nonnull const kMAOptionsBAAOIDNonce;
    52 extern NSString * _Nonnull const kMAOptionsBAAOIDSToInclude;
    53 extern NSString * _Nonnull const kMAOptionsBAASCRTAttestation;
    54 extern NSString * _Nonnull const kMAOptionsBAAValidity;
     51    static UniqueRef<AuthenticatorTransportService> create(WebCore::AuthenticatorTransport, Observer&);
     52    static UniqueRef<AuthenticatorTransportService> createMock(WebCore::AuthenticatorTransport, Observer&, const MockWebAuthenticationConfiguration&);
    5553
    56 extern "C"
    57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull);
     54    virtual ~AuthenticatorTransportService() = default;
    5855
    59 #endif // USE(APPLE_INTERNAL_SDK)
     56    // This operation is guaranteed to execute asynchronously.
     57    void startDiscovery() const;
    6058
    61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     59protected:
     60    explicit AuthenticatorTransportService(Observer&);
     61
     62    Observer* observer() const { return m_observer.get(); }
     63
     64private:
     65    virtual void startDiscoveryInternal() const = 0;
     66
     67    WeakPtr<Observer> m_observer;
     68};
     69
     70} // namespace WebKit
    6271
    6372#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    2928#import <wtf/SoftLinking.h>
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30SOFT_LINK_FRAMEWORK(LocalAuthentication);
    3231
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     32SOFT_LINK_CLASS(LocalAuthentication, LAContext);
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h

    r236480 r236481  
    2828#if ENABLE(WEB_AUTHN)
    2929
    30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     30#include "Authenticator.h"
     31#include "LocalConnection.h"
     32#include <wtf/UniqueRef.h>
    3133
    32 #if USE(APPLE_INTERNAL_SDK)
     34OBJC_CLASS LAContext;
    3335
    34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300
    35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    36 #endif
     36namespace WebKit {
    3737
    38 extern "C" {
    39 #import <DeviceIdentity/DeviceIdentity.h>
    40 }
     38class LocalAuthenticator final : public Authenticator {
     39public:
     40    // Here is the FSM.
     41    // MakeCredential: Init => RequestReceived => UserConsented => Attested => End
     42    // GetAssertion: Init => RequestReceived => UserConsented => End
     43    enum class State {
     44        Init,
     45        RequestReceived,
     46        UserConsented,
     47        Attested,
     48    };
    4149
    42 #else
     50    static Ref<LocalAuthenticator> create(UniqueRef<LocalConnection>&& connection)
     51    {
     52        return adoptRef(*new LocalAuthenticator(WTFMove(connection)));
     53    }
    4354
    44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     55private:
     56    explicit LocalAuthenticator(UniqueRef<LocalConnection>&&);
    4557
    46 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    47 extern NSString * _Nonnull const kMAOptionsBAAIgnoreExistingKeychainItems;
    48 extern NSString * _Nonnull const kMAOptionsBAAKeychainAccessGroup;
    49 extern NSString * _Nonnull const kMAOptionsBAAKeychainLabel;
    50 extern NSString * _Nonnull const kMAOptionsBAANonce;
    51 extern NSString * _Nonnull const kMAOptionsBAAOIDNonce;
    52 extern NSString * _Nonnull const kMAOptionsBAAOIDSToInclude;
    53 extern NSString * _Nonnull const kMAOptionsBAASCRTAttestation;
    54 extern NSString * _Nonnull const kMAOptionsBAAValidity;
     58    void makeCredential() final;
     59    void continueMakeCredentialAfterUserConsented(LocalConnection::UserConsent);
     60    void continueMakeCredentialAfterAttested(SecKeyRef, NSArray *certificates, NSError *);
    5561
    56 extern "C"
    57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull);
     62    void getAssertion() final;
     63    void continueGetAssertionAfterUserConsented(LocalConnection::UserConsent, LAContext *, const Vector<uint8_t>& credentialId, const Vector<uint8_t>& userhandle);
    5864
    59 #endif // USE(APPLE_INTERNAL_SDK)
     65    State m_state { State::Init };
     66    UniqueRef<LocalConnection> m_connection;
     67};
    6068
    61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     69} // namespace WebKit
    6270
    6371#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.h

    r236480 r236481  
    2828#if ENABLE(WEB_AUTHN)
    2929
    30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     30#include <wtf/CompletionHandler.h>
    3131
    32 #if USE(APPLE_INTERNAL_SDK)
     32OBJC_CLASS LAContext;
    3333
    34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300
    35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    36 #endif
     34namespace WebKit {
    3735
    38 extern "C" {
    39 #import <DeviceIdentity/DeviceIdentity.h>
    40 }
     36// Local authenticators normally doesn't need to establish connections
     37// between the platform and themselves as they are attached.
     38// However, such abstraction is still provided to isolate operations
     39// that are not allowed in auto test environment such that some mocking
     40// mechnism can override them.
     41class LocalConnection {
     42    WTF_MAKE_FAST_ALLOCATED;
     43    WTF_MAKE_NONCOPYABLE(LocalConnection);
     44public:
     45    enum class UserConsent {
     46        No,
     47        Yes
     48    };
    4149
    42 #else
     50    using AttestationCallback = CompletionHandler<void(SecKeyRef, NSArray *, NSError *)>;
     51    using UserConsentCallback = CompletionHandler<void(UserConsent)>;
     52    using UserConsentContextCallback = CompletionHandler<void(UserConsent, LAContext *)>;
    4353
    44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     54    LocalConnection() = default;
     55    virtual ~LocalConnection() = default;
    4556
    46 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    47 extern NSString * _Nonnull const kMAOptionsBAAIgnoreExistingKeychainItems;
    48 extern NSString * _Nonnull const kMAOptionsBAAKeychainAccessGroup;
    49 extern NSString * _Nonnull const kMAOptionsBAAKeychainLabel;
    50 extern NSString * _Nonnull const kMAOptionsBAANonce;
    51 extern NSString * _Nonnull const kMAOptionsBAAOIDNonce;
    52 extern NSString * _Nonnull const kMAOptionsBAAOIDSToInclude;
    53 extern NSString * _Nonnull const kMAOptionsBAASCRTAttestation;
    54 extern NSString * _Nonnull const kMAOptionsBAAValidity;
     57    // Overrided by MockLocalConnection.
     58    virtual void getUserConsent(const String& reason, UserConsentCallback&&) const;
     59    virtual void getUserConsent(const String& reason, SecAccessControlRef, UserConsentContextCallback&&) const;
     60    virtual void getAttestation(const String& rpId, const String& username, const Vector<uint8_t>& hash, AttestationCallback&&) const;
     61};
    5562
    56 extern "C"
    57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull);
    58 
    59 #endif // USE(APPLE_INTERNAL_SDK)
    60 
    61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     63} // namespace WebKit
    6264
    6365#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include "AuthenticatorTransportService.h"
    3231
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     32namespace WebKit {
     33
     34class LocalConnection;
     35
     36class LocalService : public AuthenticatorTransportService {
     37public:
     38    explicit LocalService(Observer&);
     39
     40    static bool isAvailable();
     41
     42private:
     43    void startDiscoveryInternal() const final;
     44    // Overrided by MockLocalService.
     45    virtual bool platformStartDiscovery() const;
     46    virtual UniqueRef<LocalConnection> createLocalConnection() const;
     47};
     48
     49} // namespace WebKit
     50
     51#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.mm

    r236480 r236481  
    2424 */
    2525
    26 #pragma once
     26#import "config.h"
     27#import "LocalService.h"
    2728
    2829#if ENABLE(WEB_AUTHN)
    2930
    30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     31#import "LocalAuthenticator.h"
     32#import "LocalConnection.h"
    3133
    32 #if USE(APPLE_INTERNAL_SDK)
     34#import "LocalAuthenticationSoftLink.h"
    3335
    34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300
    35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    36 #endif
     36namespace WebKit {
    3737
    38 extern "C" {
    39 #import <DeviceIdentity/DeviceIdentity.h>
     38LocalService::LocalService(Observer& observer)
     39    : AuthenticatorTransportService(observer)
     40{
    4041}
    4142
     43bool LocalService::isAvailable()
     44{
     45// FIXME(182772)
     46#if !PLATFORM(IOS)
     47    return false;
    4248#else
     49    auto context = adoptNS([allocLAContextInstance() init]);
     50    NSError *error = nil;
     51    if (![context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
     52        LOG_ERROR("Couldn't find local authenticators: %@", error);
     53        return false;
     54    }
     55    return true;
     56#endif
     57}
    4358
    44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);
     59void LocalService::startDiscoveryInternal() const
     60{
     61    if (!platformStartDiscovery())
     62        return;
    4563
    46 extern NSString * _Nonnull const kMAOptionsBAAAccessControls;
    47 extern NSString * _Nonnull const kMAOptionsBAAIgnoreExistingKeychainItems;
    48 extern NSString * _Nonnull const kMAOptionsBAAKeychainAccessGroup;
    49 extern NSString * _Nonnull const kMAOptionsBAAKeychainLabel;
    50 extern NSString * _Nonnull const kMAOptionsBAANonce;
    51 extern NSString * _Nonnull const kMAOptionsBAAOIDNonce;
    52 extern NSString * _Nonnull const kMAOptionsBAAOIDSToInclude;
    53 extern NSString * _Nonnull const kMAOptionsBAASCRTAttestation;
    54 extern NSString * _Nonnull const kMAOptionsBAAValidity;
     64    if (observer())
     65        observer()->authenticatorAdded(LocalAuthenticator::create(createLocalConnection()));
     66}
    5567
    56 extern "C"
    57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull);
     68bool LocalService::platformStartDiscovery() const
     69{
     70    return LocalService::isAvailable();
     71}
    5872
    59 #endif // USE(APPLE_INTERNAL_SDK)
     73UniqueRef<LocalConnection> LocalService::createLocalConnection() const
     74{
     75    return makeUniqueRef<LocalConnection>();
     76}
    6077
    61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
     78} // namespace WebKit
    6279
    6380#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp

    r236480 r236481  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "MockAuthenticatorManager.h"
    2728
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     29#if ENABLE(WEB_AUTHN)
    3030
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     31namespace WebKit {
    3232
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     33MockAuthenticatorManager::MockAuthenticatorManager(MockWebAuthenticationConfiguration&& configuration)
     34    : m_testConfiguration(WTFMove(configuration))
     35{
     36}
     37
     38UniqueRef<AuthenticatorTransportService> MockAuthenticatorManager::createService(WebCore::AuthenticatorTransport transport, AuthenticatorTransportService::Observer& observer) const
     39{
     40    return AuthenticatorTransportService::createMock(transport, observer, m_testConfiguration);
     41}
     42
     43void MockAuthenticatorManager::respondReceivedInternal(Respond&& respond)
     44{
     45    pendingCompletionHandler()(WTFMove(respond));
     46    clearState();
     47}
     48
     49} // namespace WebKit
     50
     51#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include "AuthenticatorManager.h"
     31#include "MockWebAuthenticationConfiguration.h"
    3232
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     33namespace WebKit {
     34
     35class MockAuthenticatorManager final : public AuthenticatorManager {
     36public:
     37    explicit MockAuthenticatorManager(MockWebAuthenticationConfiguration&&);
     38
     39    bool isMock() const final { return true; }
     40    void setTestConfiguration(MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); }
     41
     42private:
     43    UniqueRef<AuthenticatorTransportService> createService(WebCore::AuthenticatorTransport, AuthenticatorTransportService::Observer&) const final;
     44    void respondReceivedInternal(Respond&&) final;
     45
     46    MockWebAuthenticationConfiguration m_testConfiguration;
     47};
     48
     49} // namespace WebKit
     50
     51#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include "LocalConnection.h"
     31#include "MockWebAuthenticationConfiguration.h"
    3232
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     33namespace WebKit {
     34
     35class MockLocalConnection final : public LocalConnection {
     36public:
     37    explicit MockLocalConnection(const MockWebAuthenticationConfiguration&);
     38
     39    void getUserConsent(const String& reason, UserConsentCallback&&) const final;
     40    void getUserConsent(const String& reason, SecAccessControlRef, UserConsentContextCallback&&) const final;
     41    void getAttestation(const String& rpId, const String& username, const Vector<uint8_t>& hash, AttestationCallback&&) const final;
     42
     43private:
     44    MockWebAuthenticationConfiguration m_configuration;
     45};
     46
     47} // namespace WebKit
     48
     49#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp

    r236480 r236481  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "MockLocalService.h"
    2728
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     29#if ENABLE(WEB_AUTHN)
    3030
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     31#import "LocalAuthenticator.h"
     32#import "MockLocalConnection.h"
     33#import <wtf/RunLoop.h>
    3234
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     35namespace WebKit {
     36
     37MockLocalService::MockLocalService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)
     38    : LocalService(observer)
     39    , m_configuration(configuration)
     40{
     41}
     42
     43bool MockLocalService::platformStartDiscovery() const
     44{
     45    // FIXME(189642): we should test false case.
     46    return true;
     47}
     48
     49UniqueRef<LocalConnection> MockLocalService::createLocalConnection() const
     50{
     51    return makeUniqueRef<MockLocalConnection>(m_configuration);
     52}
     53
     54} // namespace WebKit
     55
     56#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include "LocalService.h"
     31#include "MockWebAuthenticationConfiguration.h"
    3232
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     33namespace WebKit {
     34
     35struct MockWebAuthenticationConfiguration;
     36
     37class MockLocalService final : public LocalService {
     38public:
     39    MockLocalService(Observer&, const MockWebAuthenticationConfiguration&);
     40
     41private:
     42    bool platformStartDiscovery() const final;
     43    UniqueRef<LocalConnection> createLocalConnection() const final;
     44
     45    MockWebAuthenticationConfiguration m_configuration;
     46};
     47
     48} // namespace WebKit
     49
     50#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30namespace WebKit {
    3231
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     32struct MockWebAuthenticationConfiguration {
     33    struct Local {
     34        bool acceptAuthentication { false };
     35        bool acceptAttestation { false };
     36        String privateKeyBase64;
     37    };
     38
     39    Local local;
     40};
     41
     42} // namespace WebKit
     43
     44#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h

    r236480 r236481  
    2626#pragma once
    2727
    28 #import <LocalAuthentication/LocalAuthentication.h>
    29 #import <wtf/SoftLinking.h>
     28#if ENABLE(WEB_AUTHN)
    3029
    31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication)
     30#include <WebCore/PublicKeyCredentialCreationOptions.h>
     31#include <WebCore/PublicKeyCredentialRequestOptions.h>
     32#include <wtf/Vector.h>
    3233
    33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext)
     34namespace WebKit {
     35
     36struct WebAuthenticationRequestData {
     37    Vector<uint8_t> hash;
     38    // FIXME: Maybe we could make an ABC of Options and then use safe casting here.
     39    bool isCreationRequest { true };
     40    WebCore::PublicKeyCredentialCreationOptions creationOptions;
     41    WebCore::PublicKeyCredentialRequestOptions requestOptions;
     42};
     43
     44} // namespace WebKit
     45
     46#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp

    r235888 r236481  
    2929#if ENABLE(WEB_AUTHN)
    3030
     31#include "AuthenticatorManager.h"
     32#include "LocalService.h"
    3133#include "WebAuthenticatorCoordinatorMessages.h"
    3234#include "WebAuthenticatorCoordinatorProxyMessages.h"
    3335#include "WebPageProxy.h"
    3436#include "WebProcessProxy.h"
     37#include "WebsiteDataStore.h"
    3538#include <WebCore/ExceptionData.h>
    36 #include <WebCore/LocalAuthenticator.h>
    3739#include <WebCore/PublicKeyCredentialData.h>
     40#include <wtf/MainThread.h>
    3841
    3942namespace WebKit {
     
    4346{
    4447    m_webPageProxy.process().addMessageReceiver(Messages::WebAuthenticatorCoordinatorProxy::messageReceiverName(), m_webPageProxy.pageID(), *this);
    45     m_authenticator = std::make_unique<WebCore::LocalAuthenticator>();
    4648}
    4749
     
    5355void WebAuthenticatorCoordinatorProxy::makeCredential(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options)
    5456{
    55     // FIXME(182767)
    56     if (!m_authenticator) {
    57         requestReply({ }, { WebCore::NotAllowedError, "No avaliable authenticators."_s });
    58         return;
    59     }
    60     // FIXME(183534): Weak pointers doesn't work in another thread because of race condition.
    6157    auto callback = [weakThis = makeWeakPtr(*this)] (Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>&& result) {
     58        ASSERT(RunLoop::isMain());
    6259        if (!weakThis)
    6360            return;
     
    6966        });
    7067    };
    71     m_authenticator->makeCredential(hash, options, WTFMove(callback));
     68    m_webPageProxy.websiteDataStore().authenticatorManager().makeCredential(hash, options, WTFMove(callback));
    7269}
    7370
    7471void WebAuthenticatorCoordinatorProxy::getAssertion(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options)
    7572{
    76     // FIXME(182767)
    77     if (!m_authenticator)
    78         requestReply({ }, { WebCore::NotAllowedError, "No avaliable authenticators."_s });
    79     // FIXME(183534): Weak pointers doesn't work in another thread because of race condition.
    8073    auto callback = [weakThis = makeWeakPtr(*this)] (Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>&& result) {
     74        ASSERT(RunLoop::isMain());
    8175        if (!weakThis)
    8276            return;
     
    8882        });
    8983    };
    90     m_authenticator->getAssertion(hash, options, WTFMove(callback));
     84    m_webPageProxy.websiteDataStore().authenticatorManager().getAssertion(hash, options, WTFMove(callback));
    9185}
    9286
    9387void WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable(uint64_t messageId)
    9488{
    95     if (!m_authenticator) {
    96         isUserVerifyingPlatformAuthenticatorAvailableReply(messageId, false);
    97         return;
    98     }
    99     isUserVerifyingPlatformAuthenticatorAvailableReply(messageId, m_authenticator->isAvailable());
     89    m_webPageProxy.send(Messages::WebAuthenticatorCoordinator::IsUserVerifyingPlatformAuthenticatorAvailableReply(messageId, LocalService::isAvailable()));
    10090}
    10191
     
    10595}
    10696
    107 void WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply(uint64_t messageId, bool result)
    108 {
    109     m_webPageProxy.send(Messages::WebAuthenticatorCoordinator::IsUserVerifyingPlatformAuthenticatorAvailableReply(messageId, result));
    110 }
    111 
    11297} // namespace WebKit
    11398
  • trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h

    r235888 r236481  
    3434
    3535namespace WebCore {
    36 class LocalAuthenticator;
    37 
    3836struct ExceptionData;
    3937struct PublicKeyCredentialCreationOptions;
     
    6361    // Senders.
    6462    void requestReply(const WebCore::PublicKeyCredentialData&, const WebCore::ExceptionData&);
    65     void isUserVerifyingPlatformAuthenticatorAvailableReply(uint64_t messageId, bool);
    6663
    6764    WebPageProxy& m_webPageProxy;
    68     std::unique_ptr<WebCore::LocalAuthenticator> m_authenticator;
    6965};
    7066
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r236477 r236481  
    3030#include "APIWebsiteDataRecord.h"
    3131#include "APIWebsiteDataStore.h"
     32#include "AuthenticatorManager.h"
     33#include "MockAuthenticatorManager.h"
    3234#include "NetworkProcessMessages.h"
    3335#include "StorageManager.h"
     
    9799    , m_storageManager(StorageManager::create(m_configuration.localStorageDirectory))
    98100    , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
     101#if ENABLE(WEB_AUTHN)
     102    , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
     103#endif
    99104{
    100105    WTF::setProcessPrivileges(allPrivileges());
     
    109114    , m_configuration()
    110115    , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
     116#if ENABLE(WEB_AUTHN)
     117    , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>())
     118#endif
    111119{
    112120    maybeRegisterWithSessionIDMap();
     
    16521660#endif
    16531661
    1654 }
     1662#if ENABLE(WEB_AUTHN)
     1663void WebsiteDataStore::setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&& configuration)
     1664{
     1665    if (!m_authenticatorManager->isMock())
     1666        m_authenticatorManager = makeUniqueRef<MockAuthenticatorManager>(WTFMove(configuration));
     1667    static_cast<MockAuthenticatorManager*>(&m_authenticatorManager)->setTestConfiguration(WTFMove(configuration));
     1668}
     1669#endif
     1670
     1671}
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r236216 r236481  
    3838#include <wtf/RefCounted.h>
    3939#include <wtf/RefPtr.h>
     40#include <wtf/UniqueRef.h>
    4041#include <wtf/WeakPtr.h>
    4142#include <wtf/WorkQueue.h>
     
    5253namespace WebKit {
    5354
     55class AuthenticatorManager;
    5456class SecKeyProxyStore;
    5557class StorageManager;
     
    5961enum class WebsiteDataFetchOption;
    6062enum class WebsiteDataType;
     63struct MockWebAuthenticationConfiguration;
    6164struct StorageProcessCreationParameters;
    6265struct WebsiteDataRecord;
     
    190193#endif
    191194
     195#if ENABLE(WEB_AUTHN)
     196    AuthenticatorManager& authenticatorManager() { return m_authenticatorManager.get(); }
     197    void setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&&);
     198#endif
     199
    192200private:
    193201    explicit WebsiteDataStore(PAL::SessionID);
     
    248256    Vector<Ref<SecKeyProxyStore>> m_secKeyProxyStores;
    249257#endif
     258
     259#if ENABLE(WEB_AUTHN)
     260    UniqueRef<AuthenticatorManager> m_authenticatorManager;
     261#endif
    250262};
    251263
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r236477 r236481  
    10291029                53DEA3661DDE423100E82648 /* json.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 53DEA3651DDE422E00E82648 /* json.hpp */; };
    10301030                570AB8F320AE3BD700B8BE87 /* SecKeyProxyStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F220AE3BD700B8BE87 /* SecKeyProxyStore.h */; };
     1031                578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; };
    10311032                57B4B46020B504AC00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B4B45E20B504AB00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h */; };
    10321033                57DCED6E2142EE5E0016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */; };
     
    10341035                57DCED702142EE680016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6C2142EAF90016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp */; };
    10351036                57DCED712142EE6C0016B847 /* WebAuthenticatorCoordinatorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED6D2142EAFA0016B847 /* WebAuthenticatorCoordinatorProxyMessages.h */; };
     1037                57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */; };
     1038                57DCEDAC214C60270016B847 /* LocalAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDA12149C1E20016B847 /* LocalAuthenticator.h */; };
     1039                57DCEDAD214C602C0016B847 /* LocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDA7214A568B0016B847 /* LocalConnection.h */; };
     1040                57DCEDAE214C60330016B847 /* LocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED9A2148B0830016B847 /* LocalService.h */; };
     1041                57DCEDAF214C603B0016B847 /* AuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED842147363A0016B847 /* AuthenticatorManager.h */; };
     1042                57DCEDB0214C60420016B847 /* AuthenticatorTransportService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED8A214853130016B847 /* AuthenticatorTransportService.h */; };
     1043                57DCEDB1214C60480016B847 /* Authenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED8B21485BD70016B847 /* Authenticator.h */; };
     1044                57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */; };
     1045                57DCEDB3214C60530016B847 /* WebAuthenticatorCoordinatorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57608295202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.h */; };
     1046                57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */; };
     1047                57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC1214F114C0016B847 /* MockLocalService.h */; };
     1048                57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC5214F18300016B847 /* MockLocalConnection.h */; };
     1049                57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; };
    10361050                5C0B17781E7C880E00E9123C /* NetworkSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */; };
    10371051                5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */; };
     
    33803394                57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticatorCoordinatorProxy.cpp; sourceTree = "<group>"; };
    33813395                57608299202BDAE200116678 /* WebAuthenticatorCoordinatorProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebAuthenticatorCoordinatorProxy.messages.in; sourceTree = "<group>"; };
     3396                578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSoftLink.h; sourceTree = "<group>"; };
    33823397                57B4B45D20B504AB00D4AD79 /* AuthenticationManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AuthenticationManagerCocoa.mm; path = Authentication/cocoa/AuthenticationManagerCocoa.mm; sourceTree = "<group>"; };
    33833398                57B4B45E20B504AB00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClientCertificateAuthenticationXPCConstants.h; path = Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h; sourceTree = "<group>"; };
     
    33863401                57DCED6C2142EAF90016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticatorCoordinatorProxyMessageReceiver.cpp; sourceTree = "<group>"; };
    33873402                57DCED6D2142EAFA0016B847 /* WebAuthenticatorCoordinatorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticatorCoordinatorProxyMessages.h; sourceTree = "<group>"; };
     3403                57DCED842147363A0016B847 /* AuthenticatorManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorManager.h; sourceTree = "<group>"; };
     3404                57DCED852147363A0016B847 /* AuthenticatorManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticatorManager.cpp; sourceTree = "<group>"; };
     3405                57DCED8A214853130016B847 /* AuthenticatorTransportService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorTransportService.h; sourceTree = "<group>"; };
     3406                57DCED8B21485BD70016B847 /* Authenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Authenticator.h; sourceTree = "<group>"; };
     3407                57DCED9921489F4D0016B847 /* AuthenticatorTransportService.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticatorTransportService.cpp; sourceTree = "<group>"; };
     3408                57DCED9A2148B0830016B847 /* LocalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalService.h; sourceTree = "<group>"; };
     3409                57DCEDA02148FA0F0016B847 /* LocalService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalService.mm; sourceTree = "<group>"; };
     3410                57DCEDA12149C1E20016B847 /* LocalAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticator.h; sourceTree = "<group>"; };
     3411                57DCEDA32149DFF50016B847 /* LocalAuthenticator.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticator.mm; sourceTree = "<group>"; };
     3412                57DCEDA42149E64A0016B847 /* Authenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Authenticator.cpp; sourceTree = "<group>"; };
     3413                57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationRequestData.h; sourceTree = "<group>"; };
     3414                57DCEDA7214A568B0016B847 /* LocalConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalConnection.h; sourceTree = "<group>"; };
     3415                57DCEDA8214A568B0016B847 /* LocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalConnection.mm; sourceTree = "<group>"; };
     3416                57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceIdentitySPI.h; sourceTree = "<group>"; };
     3417                57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockWebAuthenticationConfiguration.h; sourceTree = "<group>"; };
     3418                57DCEDC1214F114C0016B847 /* MockLocalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockLocalService.h; sourceTree = "<group>"; };
     3419                57DCEDC2214F114C0016B847 /* MockLocalService.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockLocalService.cpp; sourceTree = "<group>"; };
     3420                57DCEDC5214F18300016B847 /* MockLocalConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockLocalConnection.h; sourceTree = "<group>"; };
     3421                57DCEDC6214F18300016B847 /* MockLocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockLocalConnection.mm; sourceTree = "<group>"; };
     3422                57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockAuthenticatorManager.h; sourceTree = "<group>"; };
     3423                57DCEDCD214F51680016B847 /* MockAuthenticatorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockAuthenticatorManager.cpp; sourceTree = "<group>"; };
    33883424                5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkSocketStreamMessageReceiver.cpp; sourceTree = "<group>"; };
    33893425                5C0B17751E7C879C00E9123C /* NetworkSocketStreamMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkSocketStreamMessages.h; sourceTree = "<group>"; };
     
    59125948                                37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */,
    59135949                                A1FB68261F6E51C100C43F9F /* CrashReporterClientSPI.h */,
     5950                                57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */,
    59145951                                3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */,
    59155952                                37B47E2C1D64DB76005F4EFF /* objcSPI.h */,
     
    67366773                        isa = PBXGroup;
    67376774                        children = (
     6775                                57DCED9E2148F9D10016B847 /* Cocoa */,
     6776                                57DCEDBD214C9FA90016B847 /* Mock */,
     6777                                57DCEDA42149E64A0016B847 /* Authenticator.cpp */,
     6778                                57DCED8B21485BD70016B847 /* Authenticator.h */,
     6779                                57DCED852147363A0016B847 /* AuthenticatorManager.cpp */,
     6780                                57DCED842147363A0016B847 /* AuthenticatorManager.h */,
     6781                                57DCED9921489F4D0016B847 /* AuthenticatorTransportService.cpp */,
     6782                                57DCED8A214853130016B847 /* AuthenticatorTransportService.h */,
     6783                                57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */,
    67386784                                57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */,
    67396785                                57608295202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.h */,
     
    67506796                        );
    67516797                        name = cocoa;
     6798                        sourceTree = "<group>";
     6799                };
     6800                57DCED9E2148F9D10016B847 /* Cocoa */ = {
     6801                        isa = PBXGroup;
     6802                        children = (
     6803                                578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */,
     6804                                57DCEDA12149C1E20016B847 /* LocalAuthenticator.h */,
     6805                                57DCEDA32149DFF50016B847 /* LocalAuthenticator.mm */,
     6806                                57DCEDA7214A568B0016B847 /* LocalConnection.h */,
     6807                                57DCEDA8214A568B0016B847 /* LocalConnection.mm */,
     6808                                57DCED9A2148B0830016B847 /* LocalService.h */,
     6809                                57DCEDA02148FA0F0016B847 /* LocalService.mm */,
     6810                        );
     6811                        path = Cocoa;
     6812                        sourceTree = "<group>";
     6813                };
     6814                57DCEDBD214C9FA90016B847 /* Mock */ = {
     6815                        isa = PBXGroup;
     6816                        children = (
     6817                                57DCEDCD214F51680016B847 /* MockAuthenticatorManager.cpp */,
     6818                                57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */,
     6819                                57DCEDC5214F18300016B847 /* MockLocalConnection.h */,
     6820                                57DCEDC6214F18300016B847 /* MockLocalConnection.mm */,
     6821                                57DCEDC2214F114C0016B847 /* MockLocalService.cpp */,
     6822                                57DCEDC1214F114C0016B847 /* MockLocalService.h */,
     6823                                57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */,
     6824                        );
     6825                        path = Mock;
    67526826                        sourceTree = "<group>";
    67536827                };
     
    88968970                                518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */,
    88978971                                512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */,
     8972                                57DCEDB1214C60480016B847 /* Authenticator.h in Headers */,
     8973                                57DCEDAF214C603B0016B847 /* AuthenticatorManager.h in Headers */,
     8974                                57DCEDB0214C60420016B847 /* AuthenticatorTransportService.h in Headers */,
    88988975                                7CD102DA1866770600ED429D /* AutoCorrectionCallback.h in Headers */,
    88998976                                9955A6EF1C79810800EB6A93 /* Automation.json in Headers */,
     
    89319008                                1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
    89329009                                BC032DA610F437D10058C15A /* Decoder.h in Headers */,
     9010                                57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */,
    89339011                                83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */,
    89349012                                C18173612058424700DFDA65 /* DisplayLink.h in Headers */,
     
    90179095                                413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */,
    90189096                                2D1087611D2C573E00B85F82 /* LoadParameters.h in Headers */,
     9097                                578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */,
     9098                                57DCEDAC214C60270016B847 /* LocalAuthenticator.h in Headers */,
     9099                                57DCEDAD214C602C0016B847 /* LocalConnection.h in Headers */,
     9100                                57DCEDAE214C60330016B847 /* LocalService.h in Headers */,
    90199101                                1A1D8BA21731A36300141DA4 /* LocalStorageDatabase.h in Headers */,
    90209102                                1A8C728D1738477C000A6554 /* LocalStorageDatabaseTracker.h in Headers */,
     
    90319113                                1AAB037A185A7C6A00EDF501 /* MessageSender.h in Headers */,
    90329114                                A13B3DA2207F39DE0090C58D /* MobileWiFiSPI.h in Headers */,
     9115                                57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */,
     9116                                57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */,
     9117                                57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */,
     9118                                57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */,
    90339119                                C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
    90349120                                2D50366B1BCDE17900E20BB3 /* NativeWebGestureEvent.h in Headers */,
     
    92749360                                1A8E7D3D18C15149005A702A /* VisitedLinkTableControllerMessages.h in Headers */,
    92759361                                CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */,
     9362                                57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */,
    92769363                                57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */,
     9364                                57DCEDB3214C60530016B847 /* WebAuthenticatorCoordinatorProxy.h in Headers */,
    92779365                                57DCED712142EE6C0016B847 /* WebAuthenticatorCoordinatorProxyMessages.h in Headers */,
    92789366                                9955A6EC1C7980C200EB6A93 /* WebAutomationSession.h in Headers */,
  • trunk/Tools/ChangeLog

    r236477 r236481  
     12018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Make AuthenticatorManager
     4        https://bugs.webkit.org/show_bug.cgi?id=189279
     5        <rdar://problem/44116792>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Besides the functionality to set the WebAuthenticationMockConfiguration. Three operations are
     10        added to manipulate Keychain: addTestKeyToKeychain, cleanUpKeychain and keyExistedInKeychain.
     11
     12        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     13        * TestWebKitAPI/Tests/ios/LocalAuthenticator.mm: Removed.
     14        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     15        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     16        (WTR::TestRunner::setWebAuthenticationMockConfiguration):
     17        (WTR::TestRunner::addTestKeyToKeychain):
     18        (WTR::TestRunner::cleanUpKeychain):
     19        (WTR::TestRunner::isKeyExisted):
     20        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     21        * WebKitTestRunner/TestController.cpp:
     22        (WTR::TestController::addTestKeyToKeychain):
     23        (WTR::TestController::cleanUpKeychain):
     24        (WTR::TestController::isKeyExisted):
     25        (WTR::TestController::setWebAuthenticationMockConfiguration):
     26        * WebKitTestRunner/TestController.h:
     27        * WebKitTestRunner/TestInvocation.cpp:
     28        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     29        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     30        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
     31        (WTR::TestController::addTestKeyToKeychain):
     32        (WTR::TestController::cleanUpKeychain):
     33        (WTR::TestController::keyExistedInKeychain):
     34
    1352018-09-25  Sihui Liu  <sihui_liu@apple.com>
    236
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r235878 r236481  
    4242                0F2C20B81DCD545000542D9E /* Time.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F2C20B71DCD544800542D9E /* Time.cpp */; };
    4343                0F30CB5C1FCE1796004B5323 /* ConcurrentPtrHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30CB5B1FCE1792004B5323 /* ConcurrentPtrHashSet.cpp */; };
    44                 4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; };
    4544                0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */; };
    4645                0F4FFA9E1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */; };
     
    175174                46E66A901F0D75590026D83C /* WKWebViewDiagnosticLogging.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46E66A8F1F0D75590026D83C /* WKWebViewDiagnosticLogging.mm */; };
    176175                46E816F81E79E29C00375ADC /* RestoreStateAfterTermination.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46E816F71E79E29100375ADC /* RestoreStateAfterTermination.mm */; };
     176                4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; };
    177177                4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
    178178                510477721D298DDD009747EB /* IDBDeleteRecovery.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5104776F1D298D85009747EB /* IDBDeleteRecovery.sqlite3 */; };
     
    245245                57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAB2006C55400355965 /* CBORWriterTest.cpp */; };
    246246                57303BCB2008376500355965 /* CBORReaderTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BC220071E2200355965 /* CBORReaderTest.cpp */; };
    247                 574F55CF204D37C5002948C6 /* LocalAuthenticator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 574F55CE204D3763002948C6 /* LocalAuthenticator.mm */; };
    248247                574F55D2204D47F0002948C6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 574F55D0204D471C002948C6 /* Security.framework */; };
    249248                57599E211F07191900A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */; };
     
    935934                        dstSubfolderSpec = 7;
    936935                        files = (
    937                                 C944160021430E8900B1EDDA /* audio-with-controls.html in Copy Resources */,
    938936                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
    939937                                379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
     
    952950                                37137E4B21124D01002BEEA4 /* AttrStyle.html in Copy Resources */,
    953951                                CD9E292E1C90C33F000BB800 /* audio-only.html in Copy Resources */,
     952                                C944160021430E8900B1EDDA /* audio-with-controls.html in Copy Resources */,
    954953                                CD57779C211CE91F001B371E /* audio-with-web-audio.html in Copy Resources */,
    955954                                76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */,
     
    12391238                0F2C20B71DCD544800542D9E /* Time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Time.cpp; sourceTree = "<group>"; };
    12401239                0F30CB5B1FCE1792004B5323 /* ConcurrentPtrHashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConcurrentPtrHashSet.cpp; sourceTree = "<group>"; };
    1241                 EC79F168BE454E579E417B05 /* Markable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Markable.cpp; sourceTree = "<group>"; };
    12421240                0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEvaluateJavaScript.mm; sourceTree = "<group>"; };
    12431241                0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SnapshotViaRenderInContext.mm; sourceTree = "<group>"; };
     
    15421540                57303BC220071E2200355965 /* CBORReaderTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORReaderTest.cpp; sourceTree = "<group>"; };
    15431541                5735F0251F3A4EA6000EE801 /* TestWebKitAPI-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "TestWebKitAPI-iOS.entitlements"; sourceTree = "<group>"; };
    1544                 574F55CE204D3763002948C6 /* LocalAuthenticator.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticator.mm; sourceTree = "<group>"; };
    15451542                574F55D0204D471C002948C6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
    15461543                57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBStructuredCloneBackwardCompatibility.mm; sourceTree = "<group>"; };
     
    20222019                E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
    20232020                E5036F77211BC22800BFDBE2 /* color-drop.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "color-drop.html"; sourceTree = "<group>"; };
     2021                EC79F168BE454E579E417B05 /* Markable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Markable.cpp; sourceTree = "<group>"; };
    20242022                ECA680CD1E68CC0900731D20 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; };
    20252023                F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
     
    25552553                                F4BC0B132146C849002A0478 /* FocusPreservationTests.mm */,
    25562554                                F45E15722112CE2900307E82 /* KeyboardInputTestsIOS.mm */,
    2557                                 574F55CE204D3763002948C6 /* LocalAuthenticator.mm */,
    25582555                                7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */,
    25592556                                F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */,
     
    26222619                        isa = PBXGroup;
    26232620                        children = (
    2624                                 C94415FF21430B6700B1EDDA /* audio-with-controls.html */,
    26252621                                C25CCA0C1E5140E50026CB8A /* AllAhem.svg */,
    26262622                                F4A9202E1FEE34C800F59590 /* apple-data-url.html */,
     
    26312627                                F4856CA21E6498A8009D7EE7 /* attachment-element.html */,
    26322628                                3760C4F221124BD000233ACC /* AttrStyle.html */,
     2629                                C94415FF21430B6700B1EDDA /* audio-with-controls.html */,
    26332630                                CD57779A211CE6B7001B371E /* audio-with-web-audio.html */,
    26342631                                F41AB9981EF4692C0083FA08 /* autofocus-contenteditable.html */,
     
    38643861                                7C83E0C01D0A652700FEBCF3 /* LoadInvalidURLRequest.mm in Sources */,
    38653862                                7CCE7F001A411AE600447C4C /* LoadPageOnCrash.cpp in Sources */,
    3866                                 574F55CF204D37C5002948C6 /* LocalAuthenticator.mm in Sources */,
    38673863                                51E6A8941D2F1C0A00C004B6 /* LocalStorageClear.mm in Sources */,
    38683864                                CA38459620AE17A900990D3B /* LocalStorageDatabaseTracker.mm in Sources */,
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r236216 r236481  
    352352
    353353    void sendDisplayConfigurationChangedMessageForTesting();
     354
     355    // WebAuthN
     356    void setWebAuthenticationMockConfiguration(object configuration);
     357    void addTestKeyToKeychain(DOMString privateKeyBase64, DOMString attrLabel, DOMString applicationTagBase64);
     358    void cleanUpKeychain(DOMString attrLabel);
     359    boolean keyExistsInKeychain(DOMString attrLabel, DOMString applicationTagBase64);
    354360};
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r236216 r236481  
    23492349}
    23502350
     2351// WebAuthN
     2352void TestRunner::setWebAuthenticationMockConfiguration(JSValueRef configurationValue)
     2353{
     2354    auto& injectedBundle = InjectedBundle::singleton();
     2355    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
     2356    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
     2357    if (!JSValueIsObject(context, configurationValue))
     2358        return;
     2359    JSObjectRef configuration = JSValueToObject(context, configurationValue, 0);
     2360
     2361    JSRetainPtr<JSStringRef> localPropertyName(Adopt, JSStringCreateWithUTF8CString("local"));
     2362    JSValueRef localValue = JSObjectGetProperty(context, configuration, localPropertyName.get(), 0);
     2363    if (!JSValueIsObject(context, localValue))
     2364        return;
     2365    JSObjectRef local = JSValueToObject(context, localValue, 0);
     2366
     2367    JSRetainPtr<JSStringRef> acceptAuthenticationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAuthentication"));
     2368    JSValueRef acceptAuthenticationValue = JSObjectGetProperty(context, local, acceptAuthenticationPropertyName.get(), 0);
     2369    if (!JSValueIsBoolean(context, acceptAuthenticationValue))
     2370        return;
     2371    bool acceptAuthentication = JSValueToBoolean(context, acceptAuthenticationValue);
     2372
     2373    JSRetainPtr<JSStringRef> acceptAttestationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAttestation"));
     2374    JSValueRef acceptAttestationValue = JSObjectGetProperty(context, local, acceptAttestationPropertyName.get(), 0);
     2375    if (!JSValueIsBoolean(context, acceptAttestationValue))
     2376        return;
     2377    bool acceptAttestation = JSValueToBoolean(context, acceptAttestationValue);
     2378
     2379    JSRetainPtr<JSStringRef> privateKeyBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("privateKeyBase64"));
     2380    JSValueRef privateKeyBase64Value = JSObjectGetProperty(context, local, privateKeyBase64PropertyName.get(), 0);
     2381    if (!JSValueIsString(context, privateKeyBase64Value))
     2382        return;
     2383
     2384    Vector<WKRetainPtr<WKStringRef>> localKeys;
     2385    Vector<WKRetainPtr<WKTypeRef>> localValues;
     2386    localKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("AcceptAuthentication") });
     2387    localValues.append(adoptWK(WKBooleanCreate(acceptAuthentication)).get());
     2388    localKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("AcceptAttestation") });
     2389    localValues.append(adoptWK(WKBooleanCreate(acceptAttestation)).get());
     2390    localKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("PrivateKeyBase64") });
     2391    localValues.append(toWK(adopt(JSValueToStringCopy(context, privateKeyBase64Value, 0)).get()));
     2392
     2393    Vector<WKStringRef> rawLocalKeys;
     2394    Vector<WKTypeRef> rawLocalValues;
     2395    rawLocalKeys.resize(localKeys.size());
     2396    rawLocalValues.resize(localValues.size());
     2397    for (size_t i = 0; i < localKeys.size(); ++i) {
     2398        rawLocalKeys[i] = localKeys[i].get();
     2399        rawLocalValues[i] = localValues[i].get();
     2400    }
     2401
     2402    Vector<WKRetainPtr<WKStringRef>> configurationKeys;
     2403    Vector<WKRetainPtr<WKTypeRef>> configurationValues;
     2404    configurationKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("Local") });
     2405    configurationValues.append({ AdoptWK, WKDictionaryCreate(rawLocalKeys.data(), rawLocalValues.data(), rawLocalKeys.size()) });
     2406
     2407    Vector<WKStringRef> rawConfigurationKeys;
     2408    Vector<WKTypeRef> rawConfigurationValues;
     2409    rawConfigurationKeys.resize(configurationKeys.size());
     2410    rawConfigurationValues.resize(configurationValues.size());
     2411    for (size_t i = 0; i < configurationKeys.size(); ++i) {
     2412        rawConfigurationKeys[i] = configurationKeys[i].get();
     2413        rawConfigurationValues[i] = configurationValues[i].get();
     2414    }
     2415
     2416    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetWebAuthenticationMockConfiguration"));
     2417    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawConfigurationKeys.data(), rawConfigurationValues.data(), rawConfigurationKeys.size()));
     2418   
     2419    WKBundlePostSynchronousMessage(injectedBundle.bundle(), messageName.get(), messageBody.get(), nullptr);
     2420}
     2421
     2422void TestRunner::addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64)
     2423{
     2424    Vector<WKRetainPtr<WKStringRef>> keys;
     2425    Vector<WKRetainPtr<WKTypeRef>> values;
     2426
     2427    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("PrivateKey") });
     2428    values.append(toWK(privateKeyBase64));
     2429
     2430    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AttrLabel") });
     2431    values.append(toWK(attrLabel));
     2432
     2433    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ApplicationTag") });
     2434    values.append(toWK(applicationTagBase64));
     2435
     2436    Vector<WKStringRef> rawKeys;
     2437    Vector<WKTypeRef> rawValues;
     2438    rawKeys.resize(keys.size());
     2439    rawValues.resize(values.size());
     2440
     2441    for (size_t i = 0; i < keys.size(); ++i) {
     2442        rawKeys[i] = keys[i].get();
     2443        rawValues[i] = values[i].get();
     2444    }
     2445
     2446    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AddTestKeyToKeychain"));
     2447    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
     2448
     2449    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     2450}
     2451
     2452void TestRunner::cleanUpKeychain(JSStringRef attrLabel)
     2453{
     2454    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("CleanUpKeychain"));
     2455    WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(attrLabel));
     2456
     2457    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     2458}
     2459
     2460bool TestRunner::keyExistsInKeychain(JSStringRef attrLabel, JSStringRef applicationTagBase64)
     2461{
     2462    Vector<WKRetainPtr<WKStringRef>> keys;
     2463    Vector<WKRetainPtr<WKTypeRef>> values;
     2464
     2465    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AttrLabel") });
     2466    values.append(toWK(attrLabel));
     2467
     2468    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ApplicationTag") });
     2469    values.append(toWK(applicationTagBase64));
     2470
     2471    Vector<WKStringRef> rawKeys;
     2472    Vector<WKTypeRef> rawValues;
     2473    rawKeys.resize(keys.size());
     2474    rawValues.resize(values.size());
     2475
     2476    for (size_t i = 0; i < keys.size(); ++i) {
     2477        rawKeys[i] = keys[i].get();
     2478        rawValues[i] = values[i].get();
     2479    }
     2480
     2481    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("KeyExistsInKeychain"));
     2482    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
     2483
     2484    WKTypeRef returnData = 0;
     2485    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), &returnData);
     2486    return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData));
     2487}
     2488
    23512489} // namespace WTR
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r236216 r236481  
    469469    void sendDisplayConfigurationChangedMessageForTesting();
    470470
     471    // WebAuthN
     472    void setWebAuthenticationMockConfiguration(JSValueRef);
     473    // FIXME(189876)
     474    void addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64);
     475    void cleanUpKeychain(JSStringRef attrLabel);
     476    bool keyExistsInKeychain(JSStringRef attrLabel, JSStringRef applicationTagBase64);
     477
    471478private:
    472479    TestRunner();
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r236216 r236481  
    31693169}
    31703170
     3171void TestController::addTestKeyToKeychain(const String&, const String&, const String&)
     3172{
     3173}
     3174
     3175void TestController::cleanUpKeychain(const String&)
     3176{
     3177}
     3178
     3179bool TestController::keyExistsInKeychain(const String&, const String&)
     3180{
     3181}
    31713182#endif
    31723183
     
    31763187}
    31773188
     3189void TestController::setWebAuthenticationMockConfiguration(WKDictionaryRef configuration)
     3190{
     3191    WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKContextGetWebsiteDataStore(platformContext()), configuration);
     3192}
     3193
    31783194} // namespace WTR
  • trunk/Tools/WebKitTestRunner/TestController.h

    r236216 r236481  
    255255    void sendDisplayConfigurationChangedMessageForTesting();
    256256
     257    void setWebAuthenticationMockConfiguration(WKDictionaryRef);
     258    void addTestKeyToKeychain(const String& privateKeyBase64, const String& attrLabel, const String& applicationTagBase64);
     259    void cleanUpKeychain(const String& attrLabel);
     260    bool keyExistsInKeychain(const String& attrLabel, const String& applicationTagBase64);
     261
    257262private:
    258263    WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef);
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r236216 r236481  
    14531453    }
    14541454
     1455    if (WKStringIsEqualToUTF8CString(messageName, "SetWebAuthenticationMockConfiguration")) {
     1456        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
     1457        TestController::singleton().setWebAuthenticationMockConfiguration(static_cast<WKDictionaryRef>(messageBody));
     1458        return nullptr;
     1459    }
     1460
     1461    if (WKStringIsEqualToUTF8CString(messageName, "AddTestKeyToKeychain")) {
     1462        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
     1463        WKDictionaryRef testKeyDictionary = static_cast<WKDictionaryRef>(messageBody);
     1464
     1465        WKRetainPtr<WKStringRef> privateKeyKey(AdoptWK, WKStringCreateWithUTF8CString("PrivateKey"));
     1466        WKStringRef privateKeyWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(testKeyDictionary, privateKeyKey.get()));
     1467
     1468        WKRetainPtr<WKStringRef> attrLabelKey(AdoptWK, WKStringCreateWithUTF8CString("AttrLabel"));
     1469        WKStringRef attrLabelWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(testKeyDictionary, attrLabelKey.get()));
     1470
     1471        WKRetainPtr<WKStringRef> applicationTagKey(AdoptWK, WKStringCreateWithUTF8CString("ApplicationTag"));
     1472        WKStringRef applicationTagWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(testKeyDictionary, applicationTagKey.get()));
     1473
     1474        TestController::singleton().addTestKeyToKeychain(toWTFString(privateKeyWK), toWTFString(attrLabelWK), toWTFString(applicationTagWK));
     1475        return nullptr;
     1476    }
     1477
     1478    if (WKStringIsEqualToUTF8CString(messageName, "CleanUpKeychain")) {
     1479        ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
     1480        TestController::singleton().cleanUpKeychain(toWTFString(static_cast<WKStringRef>(messageBody)));
     1481        return nullptr;
     1482    }
     1483
     1484    if (WKStringIsEqualToUTF8CString(messageName, "KeyExistsInKeychain")) {
     1485        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
     1486        WKDictionaryRef testDictionary = static_cast<WKDictionaryRef>(messageBody);
     1487
     1488        WKRetainPtr<WKStringRef> attrLabelKey(AdoptWK, WKStringCreateWithUTF8CString("AttrLabel"));
     1489        WKStringRef attrLabelWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(testDictionary, attrLabelKey.get()));
     1490
     1491        WKRetainPtr<WKStringRef> applicationTagKey(AdoptWK, WKStringCreateWithUTF8CString("ApplicationTag"));
     1492        WKStringRef applicationTagWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(testDictionary, applicationTagKey.get()));
     1493
     1494        bool keyExistsInKeychain = TestController::singleton().keyExistsInKeychain(toWTFString(attrLabelWK), toWTFString(applicationTagWK));
     1495        WKRetainPtr<WKTypeRef> result(AdoptWK, WKBooleanCreate(keyExistsInKeychain));
     1496        return result;
     1497    }
     1498
    14551499    ASSERT_NOT_REACHED();
    14561500    return nullptr;
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r236303 r236481  
    9191                5664A49A14326384008881BE /* TextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5664A49814326384008881BE /* TextInputController.cpp */; };
    9292                5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5670B8271386FCA5002EB355 /* EventSenderProxy.mm */; };
     93                570E75A82152DB4F00324B6E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570E75A42152DA2C00324B6E /* Security.framework */; };
    9394                6510A78211EC643800410867 /* AHEM____.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77711EC643800410867 /* AHEM____.TTF */; };
    9495                6510A78411EC643800410867 /* WebKitWeightWatcher100.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77911EC643800410867 /* WebKitWeightWatcher100.ttf */; };
     
    298299                5670B8261386FC13002EB355 /* EventSenderProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSenderProxy.h; sourceTree = "<group>"; };
    299300                5670B8271386FCA5002EB355 /* EventSenderProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventSenderProxy.mm; sourceTree = "<group>"; };
     301                570E75A42152DA2C00324B6E /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
    300302                583913D014335E95008307E5 /* JSAccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAccessibilityController.cpp; sourceTree = "<group>"; };
    301303                583913D114335E95008307E5 /* JSAccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAccessibilityController.h; sourceTree = "<group>"; };
     
    386388                        buildActionMask = 2147483647;
    387389                        files = (
     390                                570E75A82152DB4F00324B6E /* Security.framework in Frameworks */,
    388391                        );
    389392                        runOnlyForDeploymentPostprocessing = 0;
     
    635638                                2EE52CE21890A9A80010ED21 /* Foundation.framework */,
    636639                                0F73B5571BA7929E004B3EF4 /* JavaScriptCore.framework */,
     640                                570E75A42152DA2C00324B6E /* Security.framework */,
    637641                        );
    638642                        name = Frameworks;
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r235837 r236481  
    3333#import "TestRunnerWKWebView.h"
    3434#import <Foundation/Foundation.h>
     35#import <Security/SecItem.h>
    3536#import <WebKit/WKContextConfigurationRef.h>
    3637#import <WebKit/WKCookieManager.h>
     
    292293}
    293294
     295void TestController::addTestKeyToKeychain(const String& privateKeyBase64, const String& attrLabel, const String& applicationTagBase64)
     296{
     297    // FIXME(182772)
     298#if PLATFORM(IOS)
     299    NSDictionary* options = @{
     300        (id)kSecAttrKeyType: (id)kSecAttrKeyTypeECSECPrimeRandom,
     301        (id)kSecAttrKeyClass: (id)kSecAttrKeyClassPrivate,
     302        (id)kSecAttrKeySizeInBits: @256
     303    };
     304    CFErrorRef errorRef = nullptr;
     305    auto key = adoptCF(SecKeyCreateWithData(
     306        (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:privateKeyBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(),
     307        (__bridge CFDictionaryRef)options,
     308        &errorRef
     309    ));
     310    ASSERT(!errorRef);
     311
     312    NSDictionary* addQuery = @{
     313        (id)kSecValueRef: (id)key.get(),
     314        (id)kSecClass: (id)kSecClassKey,
     315        (id)kSecAttrLabel: attrLabel,
     316        (id)kSecAttrApplicationTag: adoptNS([[NSData alloc] initWithBase64EncodedString:applicationTagBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get()
     317    };
     318    OSStatus status = SecItemAdd((__bridge CFDictionaryRef)addQuery, NULL);
     319    ASSERT_UNUSED(status, !status);
     320#endif
     321}
     322
     323void TestController::cleanUpKeychain(const String& attrLabel)
     324{
     325    // FIXME(182772)
     326#if PLATFORM(IOS)
     327    NSDictionary* deleteQuery = @{
     328        (id)kSecClass: (id)kSecClassKey,
     329        (id)kSecAttrLabel: attrLabel
     330    };
     331    SecItemDelete((__bridge CFDictionaryRef)deleteQuery);
     332#endif
     333}
     334
     335bool TestController::keyExistsInKeychain(const String& attrLabel, const String& applicationTagBase64)
     336{
     337    // FIXME(182772)
     338#if PLATFORM(IOS)
     339    NSDictionary *query = @{
     340        (id)kSecClass: (id)kSecClassKey,
     341        (id)kSecAttrKeyClass: (id)kSecAttrKeyClassPrivate,
     342        (id)kSecAttrLabel: attrLabel,
     343        (id)kSecAttrApplicationTag: adoptNS([[NSData alloc] initWithBase64EncodedString:applicationTagBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(),
     344    };
     345    OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, NULL);
     346    if (!status)
     347        return true;
     348    ASSERT(status == errSecItemNotFound);
     349#endif
     350    return false;
     351}
     352
    294353} // namespace WTR
Note: See TracChangeset for help on using the changeset viewer.