haikuwebkit/Source/WebCore/Modules/credentialmanagement/BasicCredential.h

70 lines
2.3 KiB
C
Raw Permalink Normal View History

[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
[WebAuthN] Add a compile-time feature flag https://bugs.webkit.org/show_bug.cgi?id=182211 <rdar://problem/36936365> Reviewed by Brent Fulgham. .: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/tools/vsprops/FeatureDefines.props: * Source/cmake/tools/vsprops/FeatureDefinesCairo.props: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: Add a compile-time feature flag for WebAuthN as most of the functionality is platform dependent. No tests. * Configurations/FeatureDefines.xcconfig: * Modules/credentialmanagement/BasicCredential.cpp: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: * Modules/credentialmanagement/CredentialsContainer.h: * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/Authenticator.cpp: * Modules/webauthn/Authenticator.h: * Modules/webauthn/AuthenticatorAssertionResponse.cpp: * Modules/webauthn/AuthenticatorAssertionResponse.h: * Modules/webauthn/AuthenticatorAssertionResponse.idl: * Modules/webauthn/AuthenticatorAttestationResponse.cpp: * Modules/webauthn/AuthenticatorAttestationResponse.h: * Modules/webauthn/AuthenticatorAttestationResponse.idl: * Modules/webauthn/AuthenticatorResponse.cpp: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Modules/webauthn/PublicKeyCredentialRequestOptions.h: * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: * Modules/webauthn/PublicKeyCredentialType.h: * Modules/webauthn/PublicKeyCredentialType.idl: * bindings/js/JSAuthenticatorResponseCustom.cpp: * bindings/js/JSBasicCredentialCustom.cpp: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: Skip WebAuthN related tests on certain platforms as they won't support it immediately. * platform/gtk/TestExpectations: * platform/ios-wk1/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/win/TestExpectations: * platform/wpe/TestExpectations: Canonical link: https://commits.webkit.org/198071@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-30 01:20:17 +00:00
#if ENABLE(WEB_AUTHN)
[WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting https://bugs.webkit.org/show_bug.cgi?id=181946 <rdar://problem/37258262> Reviewed by Chris Dumez. Source/WebCore: This patch changes the original async model from a work queue to IPC between WebProcess and UIProcess. Since all authenticator operations must be handled in the UIProcess due to sandboxing, this message passing IPC async model then surpasses the original multi threading model. To cooperate that, a CredentialsMessenger class is then created and all task dispatching code is moved thre. As an improvement over existing code, static functions from PublicKeyCredential are moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that when static functions are called, they could reach the CredentialsMessenger to interact with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later on when other Credential types are created, they can reuse the same IPC messenger. What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess for testing purpose. Covered by existing tests. * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted. (WebCore::CredentialsContainer::dispatchTask): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): Deleted. * Modules/credentialmanagement/CredentialsMessenger.cpp: Added. (WebCore::CredentialsMessenger::exceptionReply): (WebCore::CredentialsMessenger::addCreationCompletionHandler): (WebCore::CredentialsMessenger::takeCreationCompletionHandler): (WebCore::CredentialsMessenger::addRequestCompletionHandler): (WebCore::CredentialsMessenger::takeRequestCompletionHandler): (WebCore::CredentialsMessenger::addQueryCompletionHandler): (WebCore::CredentialsMessenger::takeQueryCompletionHandler): (WebCore::getIdFromAttestationObject): * Modules/credentialmanagement/CredentialsMessenger.h: Added. (WebCore::CreationReturnBundle::CreationReturnBundle): (WebCore::AssertionReturnBundle::AssertionReturnBundle): (WebCore::CredentialsMessenger::weakPtrFactory const): * Modules/webauthn/Authenticator.cpp: Removed. * Modules/webauthn/Authenticator.h: Removed. * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp. (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash): (WebCore::AuthenticatorManagerInternal::initTimer): (WebCore::AuthenticatorManagerInternal::didTimerFire): (WebCore::AuthenticatorManager::singleton): (WebCore::AuthenticatorManager::setMessenger): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted. (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted. (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted. (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted. (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted. (WebCore::PublicKeyCredential::store): Deleted. (WebCore::PublicKeyCredential::create): Deleted. (WebCore::PublicKeyCredential::rawId const): Deleted. (WebCore::PublicKeyCredential::response const): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::mockCredentialsMessenger const): * testing/Internals.h: * testing/Internals.idl: * testing/MockCredentialsMessenger.cpp: Added. (WebCore::MockCredentialsMessenger::MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::setAttestationObject): (WebCore::MockCredentialsMessenger::setAssertionReturnBundle): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): (WebCore::MockCredentialsMessenger::makeCredentialReply): (WebCore::MockCredentialsMessenger::getAssertionReply): * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. Source/WebKit: Dummy WebCredentialsMessenger and WebCredentialsMessengerProxy are crafted to establish a message exchange channel between UIProcess and WebProcess. * DerivedSources.make: * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy): (WebKit::WebCredentialsMessengerProxy::~WebCredentialsMessengerProxy): (WebKit::WebCredentialsMessengerProxy::makeCredential): (WebKit::WebCredentialsMessengerProxy::getAssertion): * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in: Added. * UIProcess/WebPageProxy.cpp: (WebKit::m_configurationPreferenceValues): (WebKit::WebPageProxy::reattachToWebProcess): (WebKit::WebPageProxy::resetState): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. (WebKit::WebCredentialsMessenger::WebCredentialsMessenger): (WebKit::WebCredentialsMessenger::~WebCredentialsMessenger): (WebKit::WebCredentialsMessenger::makeCredential): (WebKit::WebCredentialsMessenger::getAssertion): (WebKit::WebCredentialsMessenger::makeCredentialReply): (WebKit::WebCredentialsMessenger::getAssertionReply): * WebProcess/CredentialManagement/WebCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_credentialsMessenger): (WebKit::m_cpuLimit): Deleted. * WebProcess/WebPage/WebPage.h: LayoutTests: * http/wpt/credential-management/credentialscontainer-store-basics.https.html: * http/wpt/webauthn/idl.https.html: * http/wpt/webauthn/public-key-credential-create-failure.https.html: * http/wpt/webauthn/public-key-credential-create-success.https.html: * http/wpt/webauthn/public-key-credential-get-failure.https.html: * http/wpt/webauthn/public-key-credential-get-success.https.html: * http/wpt/webauthn/resources/util.js: Canonical link: https://commits.webkit.org/198590@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-15 19:02:50 +00:00
#include <wtf/RefCounted.h>
[WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=181928 <rdar://problem/36459893> Reviewed by Brent Fulgham. Source/WebCore: This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec. Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole process. Those limitations will then be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html http/wpt/webauthn/idl.https.html http/wpt/webauthn/public-key-credential-create-failure.https.html http/wpt/webauthn/public-key-credential-create-success.https.html * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::PendingPromise::PendingPromise): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::preventSilentAccess): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::Authenticator::singleton): (WebCore::Authenticator::makeCredential const): * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::authenticatorData const): (WebCore::AuthenticatorAssertionResponse::signature const): (WebCore::AuthenticatorAssertionResponse::userHandle const): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted. (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted. (WebCore::AuthenticatorAssertionResponse::signature): Deleted. (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted. * Modules/webauthn/AuthenticatorAssertionResponse.h: (WebCore::AuthenticatorAssertionResponse::create): * Modules/webauthn/AuthenticatorAttestationResponse.cpp: (WebCore::AuthenticatorAttestationResponse::attestationObject const): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted. (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted. * Modules/webauthn/AuthenticatorAttestationResponse.h: (WebCore::AuthenticatorAttestationResponse::create): * Modules/webauthn/AuthenticatorResponse.cpp: (WebCore::AuthenticatorResponse::clientDataJSON const): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted. (WebCore::AuthenticatorResponse::clientDataJSON): Deleted. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): (WebCore::PublicKeyCredential::rawId const): (WebCore::PublicKeyCredential::response const): (WebCore::PublicKeyCredential::getClientExtensionResults const): (WebCore::PublicKeyCredential::rawId): Deleted. (WebCore::PublicKeyCredential::response): Deleted. (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (): Deleted. * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBindingsAllInOne.cpp: LayoutTests: Test cases are divided into two different folders. One follows wpt style. The other contains tests that I don't know how to write them in wpt style. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added. * http/tests/webauthn/resources/last-layer-frame.https.html: Added. * http/tests/webauthn/resources/second-layer-frame.https.html: Added. * http/tests/webauthn/resources/util.js: Added. It will be good to convert them into wpt style. * http/wpt/webauthn/WebAuthN.idl: Added. * http/wpt/webauthn/idl.https-expected.txt: Added. * http/wpt/webauthn/idl.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success.https.html: Added. * http/wpt/webauthn/resources/util.js: Added. Canonical link: https://commits.webkit.org/197802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-23 03:00:59 +00:00
#include <wtf/TypeCasts.h>
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
#include <wtf/text/WTFString.h>
namespace WebCore {
[WebAuthN] Revisit the whole async model of task dispatching, timeout and aborting https://bugs.webkit.org/show_bug.cgi?id=181946 <rdar://problem/37258262> Reviewed by Chris Dumez. Source/WebCore: This patch changes the original async model from a work queue to IPC between WebProcess and UIProcess. Since all authenticator operations must be handled in the UIProcess due to sandboxing, this message passing IPC async model then surpasses the original multi threading model. To cooperate that, a CredentialsMessenger class is then created and all task dispatching code is moved thre. As an improvement over existing code, static functions from PublicKeyCredential are moved to AuthenticatorManager. AuthenticatorManager is made as a singleton such that when static functions are called, they could reach the CredentialsMessenger to interact with UIProccess. CredentialsMessenger and AuthenticatorManager are separated so later on when other Credential types are created, they can reuse the same IPC messenger. What's more, a mock CredentialsMessenger is then created to mock behaviors of UIProcess for testing purpose. Covered by existing tests. * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::doesHaveSameOriginAsItsAncestors): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::PendingPromise::PendingPromise): Deleted. (WebCore::CredentialsContainer::dispatchTask): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): Deleted. * Modules/credentialmanagement/CredentialsMessenger.cpp: Added. (WebCore::CredentialsMessenger::exceptionReply): (WebCore::CredentialsMessenger::addCreationCompletionHandler): (WebCore::CredentialsMessenger::takeCreationCompletionHandler): (WebCore::CredentialsMessenger::addRequestCompletionHandler): (WebCore::CredentialsMessenger::takeRequestCompletionHandler): (WebCore::CredentialsMessenger::addQueryCompletionHandler): (WebCore::CredentialsMessenger::takeQueryCompletionHandler): (WebCore::getIdFromAttestationObject): * Modules/credentialmanagement/CredentialsMessenger.h: Added. (WebCore::CreationReturnBundle::CreationReturnBundle): (WebCore::AssertionReturnBundle::AssertionReturnBundle): (WebCore::CredentialsMessenger::weakPtrFactory const): * Modules/webauthn/Authenticator.cpp: Removed. * Modules/webauthn/Authenticator.h: Removed. * Modules/webauthn/AuthenticatorManager.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp. (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::produceClientDataJsonHash): (WebCore::AuthenticatorManagerInternal::initTimer): (WebCore::AuthenticatorManagerInternal::didTimerFire): (WebCore::AuthenticatorManager::singleton): (WebCore::AuthenticatorManager::setMessenger): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): * Modules/webauthn/AuthenticatorManager.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): Deleted. (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): Deleted. (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): Deleted. (WebCore::PublicKeyCredential::collectFromCredentialStore): Deleted. (WebCore::PublicKeyCredential::discoverFromExternalSource): Deleted. (WebCore::PublicKeyCredential::store): Deleted. (WebCore::PublicKeyCredential::create): Deleted. (WebCore::PublicKeyCredential::rawId const): Deleted. (WebCore::PublicKeyCredential::response const): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::mockCredentialsMessenger const): * testing/Internals.h: * testing/Internals.idl: * testing/MockCredentialsMessenger.cpp: Added. (WebCore::MockCredentialsMessenger::MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::setAttestationObject): (WebCore::MockCredentialsMessenger::setAssertionReturnBundle): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): (WebCore::MockCredentialsMessenger::makeCredentialReply): (WebCore::MockCredentialsMessenger::getAssertionReply): * testing/MockCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * testing/MockCredentialsMessenger.idl: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. Source/WebKit: Dummy WebCredentialsMessenger and WebCredentialsMessengerProxy are crafted to establish a message exchange channel between UIProcess and WebProcess. * DerivedSources.make: * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy): (WebKit::WebCredentialsMessengerProxy::~WebCredentialsMessengerProxy): (WebKit::WebCredentialsMessengerProxy::makeCredential): (WebKit::WebCredentialsMessengerProxy::getAssertion): * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in: Added. * UIProcess/WebPageProxy.cpp: (WebKit::m_configurationPreferenceValues): (WebKit::WebPageProxy::reattachToWebProcess): (WebKit::WebPageProxy::resetState): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. (WebKit::WebCredentialsMessenger::WebCredentialsMessenger): (WebKit::WebCredentialsMessenger::~WebCredentialsMessenger): (WebKit::WebCredentialsMessenger::makeCredential): (WebKit::WebCredentialsMessenger::getAssertion): (WebKit::WebCredentialsMessenger::makeCredentialReply): (WebKit::WebCredentialsMessenger::getAssertionReply): * WebProcess/CredentialManagement/WebCredentialsMessenger.h: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.h. * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_credentialsMessenger): (WebKit::m_cpuLimit): Deleted. * WebProcess/WebPage/WebPage.h: LayoutTests: * http/wpt/credential-management/credentialscontainer-store-basics.https.html: * http/wpt/webauthn/idl.https.html: * http/wpt/webauthn/public-key-credential-create-failure.https.html: * http/wpt/webauthn/public-key-credential-create-success.https.html: * http/wpt/webauthn/public-key-credential-get-failure.https.html: * http/wpt/webauthn/public-key-credential-get-success.https.html: * http/wpt/webauthn/resources/util.js: Canonical link: https://commits.webkit.org/198590@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-15 19:02:50 +00:00
class BasicCredential : public RefCounted<BasicCredential> {
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
public:
enum class Type {
Update Credential Management API for WebAuthentication https://bugs.webkit.org/show_bug.cgi?id=181082 <rdar://problem/36055239> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * web-platform-tests/credential-management/credentialscontainer-create-basics.https-expected.txt: * web-platform-tests/credential-management/idl.https-expected.txt: Source/WebCore: Part 2/2 This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core. which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which cannot be instantiated. Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html http/wpt/credential-management/credentialscontainer-get-basics.https.html http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html http/wpt/credential-management/idl.https.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::type const): * Modules/credentialmanagement/BasicCredential.h: (WebCore::BasicCredential::discovery const): * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::isSameOriginWithItsAncestors): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess): * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::create): (WebCore::CredentialsContainer::CredentialsContainer): Deleted. * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: (WebCore::NavigatorCredentials::credentials): * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::collectFromCredentialStore): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::store): (WebCore::PublicKeyCredential::create): * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: Tools: Enable Credential Management API for testing. * DumpRenderTree/TestOptions.h: * WebKitTestRunner/TestOptions.h: LayoutTests: This patch moves original tests for Credential Management API to http/wpt/ to better integrate with web-platform-tests infrastructure. Hopefully this will help us later on contribute tests back to W3C. * credentials/idlharness-expected.txt: Removed. * credentials/idlharness.html: Removed. * fast/dom/navigator-detached-no-crash-expected.txt: * http/wpt/credential-management/credentialscontainer-create-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-create-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html: Added. * http/wpt/credential-management/idl.https-expected.txt: Added. * http/wpt/credential-management/idl.https.html: Added. * platform/gtk/TestExpectations: * platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-elcapitan-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/win/TestExpectations: * platform/win/fast/dom/navigator-detached-no-crash-expected.txt: Canonical link: https://commits.webkit.org/197056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-02 20:28:31 +00:00
PublicKey,
};
enum class Discovery {
CredentialStore,
Remote,
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
};
[WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=181928 <rdar://problem/36459893> Reviewed by Brent Fulgham. Source/WebCore: This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec. Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole process. Those limitations will then be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html http/wpt/webauthn/idl.https.html http/wpt/webauthn/public-key-credential-create-failure.https.html http/wpt/webauthn/public-key-credential-create-success.https.html * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::PendingPromise::PendingPromise): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::preventSilentAccess): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::Authenticator::singleton): (WebCore::Authenticator::makeCredential const): * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::authenticatorData const): (WebCore::AuthenticatorAssertionResponse::signature const): (WebCore::AuthenticatorAssertionResponse::userHandle const): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted. (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted. (WebCore::AuthenticatorAssertionResponse::signature): Deleted. (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted. * Modules/webauthn/AuthenticatorAssertionResponse.h: (WebCore::AuthenticatorAssertionResponse::create): * Modules/webauthn/AuthenticatorAttestationResponse.cpp: (WebCore::AuthenticatorAttestationResponse::attestationObject const): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted. (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted. * Modules/webauthn/AuthenticatorAttestationResponse.h: (WebCore::AuthenticatorAttestationResponse::create): * Modules/webauthn/AuthenticatorResponse.cpp: (WebCore::AuthenticatorResponse::clientDataJSON const): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted. (WebCore::AuthenticatorResponse::clientDataJSON): Deleted. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): (WebCore::PublicKeyCredential::rawId const): (WebCore::PublicKeyCredential::response const): (WebCore::PublicKeyCredential::getClientExtensionResults const): (WebCore::PublicKeyCredential::rawId): Deleted. (WebCore::PublicKeyCredential::response): Deleted. (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (): Deleted. * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBindingsAllInOne.cpp: LayoutTests: Test cases are divided into two different folders. One follows wpt style. The other contains tests that I don't know how to write them in wpt style. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added. * http/tests/webauthn/resources/last-layer-frame.https.html: Added. * http/tests/webauthn/resources/second-layer-frame.https.html: Added. * http/tests/webauthn/resources/util.js: Added. It will be good to convert them into wpt style. * http/wpt/webauthn/WebAuthN.idl: Added. * http/wpt/webauthn/idl.https-expected.txt: Added. * http/wpt/webauthn/idl.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success.https.html: Added. * http/wpt/webauthn/resources/util.js: Added. Canonical link: https://commits.webkit.org/197802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-23 03:00:59 +00:00
BasicCredential(const String&, Type, Discovery);
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
virtual ~BasicCredential();
[WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=181928 <rdar://problem/36459893> Reviewed by Brent Fulgham. Source/WebCore: This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec. Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole process. Those limitations will then be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html http/wpt/webauthn/idl.https.html http/wpt/webauthn/public-key-credential-create-failure.https.html http/wpt/webauthn/public-key-credential-create-success.https.html * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::PendingPromise::PendingPromise): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::preventSilentAccess): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::Authenticator::singleton): (WebCore::Authenticator::makeCredential const): * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::authenticatorData const): (WebCore::AuthenticatorAssertionResponse::signature const): (WebCore::AuthenticatorAssertionResponse::userHandle const): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted. (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted. (WebCore::AuthenticatorAssertionResponse::signature): Deleted. (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted. * Modules/webauthn/AuthenticatorAssertionResponse.h: (WebCore::AuthenticatorAssertionResponse::create): * Modules/webauthn/AuthenticatorAttestationResponse.cpp: (WebCore::AuthenticatorAttestationResponse::attestationObject const): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted. (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted. * Modules/webauthn/AuthenticatorAttestationResponse.h: (WebCore::AuthenticatorAttestationResponse::create): * Modules/webauthn/AuthenticatorResponse.cpp: (WebCore::AuthenticatorResponse::clientDataJSON const): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted. (WebCore::AuthenticatorResponse::clientDataJSON): Deleted. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): (WebCore::PublicKeyCredential::rawId const): (WebCore::PublicKeyCredential::response const): (WebCore::PublicKeyCredential::getClientExtensionResults const): (WebCore::PublicKeyCredential::rawId): Deleted. (WebCore::PublicKeyCredential::response): Deleted. (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (): Deleted. * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBindingsAllInOne.cpp: LayoutTests: Test cases are divided into two different folders. One follows wpt style. The other contains tests that I don't know how to write them in wpt style. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added. * http/tests/webauthn/resources/last-layer-frame.https.html: Added. * http/tests/webauthn/resources/second-layer-frame.https.html: Added. * http/tests/webauthn/resources/util.js: Added. It will be good to convert them into wpt style. * http/wpt/webauthn/WebAuthN.idl: Added. * http/wpt/webauthn/idl.https-expected.txt: Added. * http/wpt/webauthn/idl.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success.https.html: Added. * http/wpt/webauthn/resources/util.js: Added. Canonical link: https://commits.webkit.org/197802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-23 03:00:59 +00:00
virtual Type credentialType() const = 0;
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
const String& id() const { return m_id; }
String type() const;
Update Credential Management API for WebAuthentication https://bugs.webkit.org/show_bug.cgi?id=181082 <rdar://problem/36055239> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * web-platform-tests/credential-management/credentialscontainer-create-basics.https-expected.txt: * web-platform-tests/credential-management/idl.https-expected.txt: Source/WebCore: Part 2/2 This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core. which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which cannot be instantiated. Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html http/wpt/credential-management/credentialscontainer-get-basics.https.html http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html http/wpt/credential-management/idl.https.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::type const): * Modules/credentialmanagement/BasicCredential.h: (WebCore::BasicCredential::discovery const): * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::isSameOriginWithItsAncestors): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess): * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::create): (WebCore::CredentialsContainer::CredentialsContainer): Deleted. * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: (WebCore::NavigatorCredentials::credentials): * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::collectFromCredentialStore): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::store): (WebCore::PublicKeyCredential::create): * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: Tools: Enable Credential Management API for testing. * DumpRenderTree/TestOptions.h: * WebKitTestRunner/TestOptions.h: LayoutTests: This patch moves original tests for Credential Management API to http/wpt/ to better integrate with web-platform-tests infrastructure. Hopefully this will help us later on contribute tests back to W3C. * credentials/idlharness-expected.txt: Removed. * credentials/idlharness.html: Removed. * fast/dom/navigator-detached-no-crash-expected.txt: * http/wpt/credential-management/credentialscontainer-create-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-create-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html: Added. * http/wpt/credential-management/idl.https-expected.txt: Added. * http/wpt/credential-management/idl.https.html: Added. * platform/gtk/TestExpectations: * platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-elcapitan-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/win/TestExpectations: * platform/win/fast/dom/navigator-detached-no-crash-expected.txt: Canonical link: https://commits.webkit.org/197056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-02 20:28:31 +00:00
Discovery discovery() const { return m_discovery; }
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
private:
String m_id;
Type m_type;
Update Credential Management API for WebAuthentication https://bugs.webkit.org/show_bug.cgi?id=181082 <rdar://problem/36055239> Reviewed by Brent Fulgham. LayoutTests/imported/w3c: * web-platform-tests/credential-management/credentialscontainer-create-basics.https-expected.txt: * web-platform-tests/credential-management/idl.https-expected.txt: Source/WebCore: Part 2/2 This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core. which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which cannot be instantiated. Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html http/wpt/credential-management/credentialscontainer-get-basics.https.html http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html http/wpt/credential-management/idl.https.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::type const): * Modules/credentialmanagement/BasicCredential.h: (WebCore::BasicCredential::discovery const): * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::CredentialsContainer): (WebCore::CredentialsContainer::isSameOriginWithItsAncestors): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess): * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::create): (WebCore::CredentialsContainer::CredentialsContainer): Deleted. * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: (WebCore::NavigatorCredentials::credentials): * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::collectFromCredentialStore): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::store): (WebCore::PublicKeyCredential::create): * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp. * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * page/RuntimeEnabledFeatures.h: Tools: Enable Credential Management API for testing. * DumpRenderTree/TestOptions.h: * WebKitTestRunner/TestOptions.h: LayoutTests: This patch moves original tests for Credential Management API to http/wpt/ to better integrate with web-platform-tests infrastructure. Hopefully this will help us later on contribute tests back to W3C. * credentials/idlharness-expected.txt: Removed. * credentials/idlharness.html: Removed. * fast/dom/navigator-detached-no-crash-expected.txt: * http/wpt/credential-management/credentialscontainer-create-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-create-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-get-basics.https.html: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https-expected.txt: Added. * http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html: Added. * http/wpt/credential-management/idl.https-expected.txt: Added. * http/wpt/credential-management/idl.https.html: Added. * platform/gtk/TestExpectations: * platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-elcapitan-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/win/TestExpectations: * platform/win/fast/dom/navigator-detached-no-crash-expected.txt: Canonical link: https://commits.webkit.org/197056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-02 20:28:31 +00:00
Discovery m_discovery;
[CredentialManagement] Add IDL definitions for Credential, SiteBoundCredential, and PasswordCredential https://bugs.webkit.org/show_bug.cgi?id=168616 <rdar://problem/30167149> Reviewed by Daniel Bates. Source/WebCore: This patch adds IDL definitions for: 1. Credential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-credential), 2. SiteBoundCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-siteboundcredential), and 3. PasswordCredential(https://w3c.github.io/webappsec-credential-management/#interfaces-credential-types-passwordcredential). Test: credentials/idlharness.html * CMakeLists.txt: * DerivedSources.make: * Modules/credentials/BasicCredential.cpp: Added. (WebCore::BasicCredential::BasicCredential): (WebCore::BasicCredential::~BasicCredential): (WebCore::BasicCredential::type): * Modules/credentials/BasicCredential.h: Added. (WebCore::BasicCredential::id): * Modules/credentials/BasicCredential.idl: Added. * Modules/credentials/CredentialData.h: Added. * Modules/credentials/CredentialData.idl: Added. * Modules/credentials/PasswordCredential.cpp: Added. (WebCore::PasswordCredential::PasswordCredential): (WebCore::PasswordCredential::PasswordCredential): Dummy constructors for now. * Modules/credentials/PasswordCredential.h: Added. (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::create): (WebCore::PasswordCredential::setIdName): (WebCore::PasswordCredential::idName): (WebCore::PasswordCredential::setPasswordName): (WebCore::PasswordCredential::passwordName): (WebCore::PasswordCredential::setAdditionalData): (WebCore::PasswordCredential::additionalData): * Modules/credentials/PasswordCredential.idl: Added. * Modules/credentials/SiteBoundCredential.cpp: Added. (WebCore::SiteBoundCredential::SiteBoundCredential): (WebCore::SiteBoundCredential::~SiteBoundCredential): * Modules/credentials/SiteBoundCredential.h: Added. (WebCore::SiteBoundCredential::name): (WebCore::SiteBoundCredential::iconURL): (WebCore::SiteBoundCredential::setOrigin): (WebCore::SiteBoundCredential::origin): * Modules/credentials/SiteBoundCredential.idl: Added. * Modules/credentials/SiteBoundCredentialData.h: Added. * Modules/credentials/SiteBoundCredentialData.idl: Added. * WebCore.xcodeproj/project.pbxproj: LayoutTests: * credentials/idlharness-expected.txt: Added. * credentials/idlharness.html: Added. * platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: * platform/mac/js/dom/global-constructors-attributes-expected.txt: * resources/WebIDLParser.js: Added. * resources/idlharness.js: Renamed from LayoutTests/imported/w3c/resources/idlharness.js. Removed LayoutTests/imported/w3c/resources/idlharness.js since it is not needed any more. Added resources/idlharness.js for idl harness. Canonical link: https://commits.webkit.org/185913@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-27 19:01:13 +00:00
};
} // namespace WebCore
[WebAuthN] Implement PublicKeyCredential's [[Create]] with a dummy authenticator https://bugs.webkit.org/show_bug.cgi?id=181928 <rdar://problem/36459893> Reviewed by Brent Fulgham. Source/WebCore: This patch implements PublicKeyCredential's [[Create]] from https://www.w3.org/TR/webauthn/#createCredential as of 5 December 2017. In order to do testing, a dummy authenticator is implemented to exercise a failure and a pass path. A number of dependencies need to be resolved later in order to comply with the spec. Also, the current architecture of handling async WebAuthN operations including dispatching, timeout, and aborting might need a redesign once the underlying authenticator is clear. Since this is our first attempt to implement a prototype, all those limitations, in my opinion, can be marked as non-blocking to accelerate the whole process. Those limitations will then be addressed once the first prototype is finshed. Tests: http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html http/wpt/webauthn/idl.https.html http/wpt/webauthn/public-key-credential-create-failure.https.html http/wpt/webauthn/public-key-credential-create-success.https.html * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::PendingPromise::PendingPromise): (WebCore::CredentialsContainer::dispatchTask): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::preventSilentAccess): Deleted. * Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::PendingPromise::create): * Modules/webauthn/Authenticator.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::Authenticator::singleton): (WebCore::Authenticator::makeCredential const): * Modules/webauthn/Authenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h. * Modules/webauthn/AuthenticatorAssertionResponse.cpp: (WebCore::AuthenticatorAssertionResponse::authenticatorData const): (WebCore::AuthenticatorAssertionResponse::signature const): (WebCore::AuthenticatorAssertionResponse::userHandle const): (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse): Deleted. (WebCore::AuthenticatorAssertionResponse::authenticatorData): Deleted. (WebCore::AuthenticatorAssertionResponse::signature): Deleted. (WebCore::AuthenticatorAssertionResponse::userHandle): Deleted. * Modules/webauthn/AuthenticatorAssertionResponse.h: (WebCore::AuthenticatorAssertionResponse::create): * Modules/webauthn/AuthenticatorAttestationResponse.cpp: (WebCore::AuthenticatorAttestationResponse::attestationObject const): (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse): Deleted. (WebCore::AuthenticatorAttestationResponse::attestationObject): Deleted. * Modules/webauthn/AuthenticatorAttestationResponse.h: (WebCore::AuthenticatorAttestationResponse::create): * Modules/webauthn/AuthenticatorResponse.cpp: (WebCore::AuthenticatorResponse::clientDataJSON const): (WebCore::AuthenticatorResponse::~AuthenticatorResponse): Deleted. (WebCore::AuthenticatorResponse::clientDataJSON): Deleted. * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: (WebCore::PublicKeyCredentialInternal::produceClientDataJson): (WebCore::PublicKeyCredentialInternal::produceClientDataJsonHash): (WebCore::PublicKeyCredentialInternal::getIdFromAttestationObject): (WebCore::PublicKeyCredential::PublicKeyCredential): (WebCore::PublicKeyCredential::discoverFromExternalSource): (WebCore::PublicKeyCredential::create): (WebCore::PublicKeyCredential::rawId const): (WebCore::PublicKeyCredential::response const): (WebCore::PublicKeyCredential::getClientExtensionResults const): (WebCore::PublicKeyCredential::rawId): Deleted. (WebCore::PublicKeyCredential::response): Deleted. (WebCore::PublicKeyCredential::getClientExtensionResults): Deleted. * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: (): Deleted. * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSAuthenticatorResponseCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBasicCredentialCustom.cpp: Copied from Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSBindingsAllInOne.cpp: LayoutTests: Test cases are divided into two different folders. One follows wpt style. The other contains tests that I don't know how to write them in wpt style. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added. * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added. * http/tests/webauthn/resources/last-layer-frame.https.html: Added. * http/tests/webauthn/resources/second-layer-frame.https.html: Added. * http/tests/webauthn/resources/util.js: Added. It will be good to convert them into wpt style. * http/wpt/webauthn/WebAuthN.idl: Added. * http/wpt/webauthn/idl.https-expected.txt: Added. * http/wpt/webauthn/idl.https.html: Added. * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-failure.https.html: Added. * http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Added. * http/wpt/webauthn/public-key-credential-create-success.https.html: Added. * http/wpt/webauthn/resources/util.js: Added. Canonical link: https://commits.webkit.org/197802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-23 03:00:59 +00:00
#define SPECIALIZE_TYPE_TRAITS_BASIC_CREDENTIAL(ToClassName, Type) \
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
static bool isType(const WebCore::BasicCredential& credential) { return credential.credentialType() == WebCore::Type; } \
SPECIALIZE_TYPE_TRAITS_END()
[WebAuthN] Add a compile-time feature flag https://bugs.webkit.org/show_bug.cgi?id=182211 <rdar://problem/36936365> Reviewed by Brent Fulgham. .: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/tools/vsprops/FeatureDefines.props: * Source/cmake/tools/vsprops/FeatureDefinesCairo.props: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: Add a compile-time feature flag for WebAuthN as most of the functionality is platform dependent. No tests. * Configurations/FeatureDefines.xcconfig: * Modules/credentialmanagement/BasicCredential.cpp: * Modules/credentialmanagement/BasicCredential.h: * Modules/credentialmanagement/BasicCredential.idl: * Modules/credentialmanagement/CredentialCreationOptions.h: * Modules/credentialmanagement/CredentialCreationOptions.idl: * Modules/credentialmanagement/CredentialRequestOptions.h: * Modules/credentialmanagement/CredentialRequestOptions.idl: * Modules/credentialmanagement/CredentialsContainer.cpp: * Modules/credentialmanagement/CredentialsContainer.h: * Modules/credentialmanagement/CredentialsContainer.idl: * Modules/credentialmanagement/NavigatorCredentials.cpp: * Modules/credentialmanagement/NavigatorCredentials.h: * Modules/credentialmanagement/NavigatorCredentials.idl: * Modules/webauthn/Authenticator.cpp: * Modules/webauthn/Authenticator.h: * Modules/webauthn/AuthenticatorAssertionResponse.cpp: * Modules/webauthn/AuthenticatorAssertionResponse.h: * Modules/webauthn/AuthenticatorAssertionResponse.idl: * Modules/webauthn/AuthenticatorAttestationResponse.cpp: * Modules/webauthn/AuthenticatorAttestationResponse.h: * Modules/webauthn/AuthenticatorAttestationResponse.idl: * Modules/webauthn/AuthenticatorResponse.cpp: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/AuthenticatorResponse.idl: * Modules/webauthn/PublicKeyCredential.cpp: * Modules/webauthn/PublicKeyCredential.h: * Modules/webauthn/PublicKeyCredential.idl: * Modules/webauthn/PublicKeyCredentialCreationOptions.h: * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: * Modules/webauthn/PublicKeyCredentialDescriptor.h: * Modules/webauthn/PublicKeyCredentialDescriptor.idl: * Modules/webauthn/PublicKeyCredentialRequestOptions.h: * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: * Modules/webauthn/PublicKeyCredentialType.h: * Modules/webauthn/PublicKeyCredentialType.idl: * bindings/js/JSAuthenticatorResponseCustom.cpp: * bindings/js/JSBasicCredentialCustom.cpp: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: Skip WebAuthN related tests on certain platforms as they won't support it immediately. * platform/gtk/TestExpectations: * platform/ios-wk1/TestExpectations: * platform/mac-wk1/TestExpectations: * platform/win/TestExpectations: * platform/wpe/TestExpectations: Canonical link: https://commits.webkit.org/198071@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-30 01:20:17 +00:00
#endif // ENABLE(WEB_AUTHN)