Changeset 236481 in webkit
- Timestamp:
- Sep 25, 2018, 3:22:36 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 17 added
- 5 deleted
- 50 edited
- 17 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r236473 r236481 1 2018-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 1 30 2018-09-25 Ryan Haddad <ryanhaddad@apple.com> 2 31 -
trunk/LayoutTests/TestExpectations
r236448 r236481 2863 2863 2864 2864 webkit.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 2867 http/wpt/credential-management/credentialscontainer-store-basics.https.html [ Skip ] 2868 http/wpt/webauthn/public-key-credential-create-failure.https.html [ Skip ] 2869 http/wpt/webauthn/public-key-credential-create-success.https.html [ Skip ] 2870 http/wpt/webauthn/public-key-credential-get-failure.https.html [ Skip ] 2871 http/wpt/webauthn/public-key-credential-get-success.https.html [ Skip ] 2872 http/wpt/webauthn/idl.https.html [ Skip ] -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html
r235888 r236481 29 29 assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.create","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}'); 30 30 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() }); 35 32 }); 36 33 }, "PublicKeyCredential's [[create]] with minimum options"); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html
r235888 r236481 23 23 assert_equals(bytesToHexString(credential.response.signature), '02'); 24 24 assert_equals(bytesToHexString(credential.response.userHandle), '03'); 25 try { 26 assert_throws("NotSupportedError", credential.getClientExtensionResults()); 27 } catch(error) { } 25 assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() }); 28 26 }); 29 27 }, "PublicKeyCredential's [[get]] with minimum options"); -
trunk/LayoutTests/http/wpt/webauthn/resources/util.js
r228523 r236481 60 60 return arrayBuffer; 61 61 } 62 63 function 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 121 function 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. 130 function 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 141 const testCredentialIdBase64url = "SMSXHngF7hEOsElA73C3RY-8bR4"; 142 const testES256PrivateKeyBase64 = 143 "BDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749VBJPgqUIwfhWHJ91nb7U" + 144 "PH76c0+WFOzZKslPyyFse4goGIW2R7k9VHLPEZl5nfnBgEVFh5zev+/xpHQIvuq6" + 145 "RQ=="; 146 const testES256PublicKeyBase64url = 147 "BDj_zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF_Qm1749VBJPgqUIwfhWHJ91nb7U" + 148 "PH76c0-WFOzZKslPyyFse4g"; 149 const testRpId = "localhost"; 150 const testUserhandleBase64 = "AAECAwQFBgcICQ=="; -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r236473 r236481 883 883 884 884 webkit.org/b/189598 compositing/backing/backing-store-attachment-fill-forwards-animation.html [ Pass Failure ] 885 886 # Skip local authenticator tests for mac now. 887 http/wpt/webauthn/public-key-credential-create-failure-local.https.html [ Skip ] 888 http/wpt/webauthn/public-key-credential-create-success-local.https.html [ Skip ] 889 http/wpt/webauthn/public-key-credential-get-failure-local.https.html [ Skip ] 890 http/wpt/webauthn/public-key-credential-get-success-local.https.html [ Skip ] -
trunk/Source/WebCore/CMakeLists.txt
r236429 r236481 416 416 Modules/webauthn/AuthenticatorAttestationResponse.idl 417 417 Modules/webauthn/AuthenticatorResponse.idl 418 Modules/webauthn/AuthenticatorTransport.idl 418 419 Modules/webauthn/PublicKeyCredential.idl 419 420 Modules/webauthn/PublicKeyCredentialCreationOptions.idl -
trunk/Source/WebCore/ChangeLog
r236478 r236481 1 2018-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 1 251 2018-09-25 YUHAN WU <yuhan_wu@apple.com> 2 252 -
trunk/Source/WebCore/Configurations/WebCore.xcconfig
r233501 r236481 87 87 WK_DATA_DETECTORS_CORE_LDFLAGS_macosx = -framework DataDetectorsCore; 88 88 89 WK_DEVICE_IDENTITY_LDFLAGS = $(WK_DEVICE_IDENTITY_LDFLAGS_$(WK_HAVE_DEVICE_IDENTITY));90 WK_DEVICE_IDENTITY_LDFLAGS_YES = -framework DeviceIdentity;91 92 89 WK_GRAPHICS_SERVICES_LDFLAGS = $(WK_GRAPHICS_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH)); 93 90 WK_GRAPHICS_SERVICES_LDFLAGS_cocoatouch = -framework GraphicsServices; … … 130 127 131 128 // 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);129 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_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); 133 130 134 131 OTHER_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; … … 189 186 TEXT_BASED_API_FILE = WebCore.tbd 190 187 191 WK_HAVE_DEVICE_IDENTITY = $(WK_HAVE_DEVICE_IDENTITY_$(PLATFORM_NAME));192 WK_HAVE_DEVICE_IDENTITY_iphoneos = YES;193 194 188 WK_HAVE_URL_FORMATTING = $(WK_HAVE_URL_FORMATTING_$(WK_PLATFORM_NAME)); 195 189 WK_HAVE_URL_FORMATTING_iphoneos = $(WK_HAVE_URL_FORMATTING$(WK_IOS_12)); -
trunk/Source/WebCore/DerivedSources.make
r236429 r236481 341 341 $(WebCore)/Modules/webauthn/AuthenticatorAttestationResponse.idl \ 342 342 $(WebCore)/Modules/webauthn/AuthenticatorResponse.idl \ 343 $(WebCore)/Modules/webauthn/AuthenticatorTransport.idl \ 343 344 $(WebCore)/Modules/webauthn/PublicKeyCredential.idl \ 344 345 $(WebCore)/Modules/webauthn/PublicKeyCredentialCreationOptions.idl \ 345 346 $(WebCore)/Modules/webauthn/PublicKeyCredentialDescriptor.idl \ 346 347 $(WebCore)/Modules/webauthn/PublicKeyCredentialRequestOptions.idl \ 347 348 $(WebCore)/Modules/webauthn/PublicKeyCredentialType.idl \ 348 349 $(WebCore)/Modules/webdatabase/DOMWindowWebDatabase.idl \ -
trunk/Source/WebCore/Modules/webauthn/AuthenticatorTransport.h
r236480 r236481 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include <wtf/EnumTraits.h> 32 31 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 32 namespace WebCore { 33 34 enum class AuthenticatorTransport { 35 Usb, 36 Nfc, 37 Ble, 38 Internal 39 }; 40 41 } // namespace WebCore 42 43 namespace WTF { 44 45 template<> 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 29 29 "usb", 30 30 "nfc", 31 "ble" 31 "ble", 32 "internal" 32 33 }; 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 32 32 #include "PublicKeyCredentialType.h" 33 33 #include <wtf/CrossThreadCopier.h> 34 #include <wtf/EnumTraits.h> 34 35 #include <wtf/Forward.h> 35 36 … … 37 38 38 39 struct PublicKeyCredentialCreationOptions { 40 enum class AuthenticatorAttachment { 41 Platform, 42 CrossPlatform 43 }; 44 39 45 struct Entity { 40 46 String name; … … 60 66 }; 61 67 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 62 75 RpEntity rp; 63 76 UserEntity user; … … 68 81 std::optional<unsigned long> timeout; 69 82 Vector<PublicKeyCredentialDescriptor> excludeCredentials; 83 std::optional<AuthenticatorSelectionCriteria> authenticatorSelection; 70 84 71 85 template<class Encoder> void encode(Encoder&) const; … … 90 104 } 91 105 106 template<class Encoder> 107 void PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode(Encoder& encoder) const 108 { 109 encoder << authenticatorAttachment; 110 } 111 112 template<class Decoder> 113 std::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 92 121 // Not every member is encoded. 93 122 template<class Encoder> … … 97 126 encoder << static_cast<uint64_t>(user.id.length()); 98 127 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; 100 129 } 101 130 … … 110 139 if (!decoder.decode(result.rp.icon)) 111 140 return std::nullopt; 112 113 std::optional<uint64_t> userIdLength; 114 decoder >> userIdLength; 115 if (!userIdLength) 141 if (!decoder.decode(result.user.idVector)) 116 142 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 121 143 if (!decoder.decode(result.user.displayName)) 122 144 return std::nullopt; … … 129 151 if (!decoder.decode(result.excludeCredentials)) 130 152 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 131 160 return result; 132 161 } … … 152 181 } 153 182 }; 183 184 template<> 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 154 192 } // namespace WTF 155 193 -
trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.idl
r227764 r236481 37 37 unsigned long timeout; 38 38 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; 42 40 // Always "direct" for us. 43 41 // AttestationConveyancePreference attestation = "none"; … … 72 70 required COSEAlgorithmIdentifier alg; 73 71 }; 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 58 58 void PublicKeyCredentialData::encode(Encoder& encoder) const 59 59 { 60 if (!rawId) { 61 encoder << true; 62 return; 63 } 64 encoder << false; 65 60 66 encoder << static_cast<uint64_t>(rawId->byteLength()); 61 67 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(rawId->data()), rawId->byteLength(), 1); … … 63 69 encoder << isAuthenticatorAttestationResponse; 64 70 65 if (isAuthenticatorAttestationResponse ) {71 if (isAuthenticatorAttestationResponse && attestationObject) { 66 72 encoder << static_cast<uint64_t>(attestationObject->byteLength()); 67 73 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(attestationObject->data()), attestationObject->byteLength(), 1); … … 69 75 } 70 76 77 if (!authenticatorData || !signature || !userHandle) 78 return; 71 79 encoder << static_cast<uint64_t>(authenticatorData->byteLength()); 72 80 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(authenticatorData->data()), authenticatorData->byteLength(), 1); … … 81 89 { 82 90 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; 83 98 84 99 std::optional<uint64_t> rawIdLength; -
trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.h
r229699 r236481 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "AuthenticatorTransport.h" 30 31 #include "BufferSource.h" 31 32 #include "PublicKeyCredentialType.h" 32 #include <wtf/EnumTraits.h>33 33 34 34 namespace WebCore { 35 35 36 36 struct PublicKeyCredentialDescriptor { 37 enum class AuthenticatorTransport {38 Usb,39 Nfc,40 Ble41 };42 43 37 PublicKeyCredentialType type; 44 38 BufferSource id; // id becomes idVector once it is passed to UIProcess. … … 54 48 { 55 49 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; 59 53 } 60 54 … … 74 68 } // namespace WebCore 75 69 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::Ble84 >;85 };86 87 }88 89 70 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl
r227764 r236481 26 26 [ 27 27 Conditional=WEB_AUTHN, 28 ] enum AuthenticatorTransport {29 "usb",30 "nfc",31 "ble"32 };33 34 [35 Conditional=WEB_AUTHN,36 28 ] dictionary PublicKeyCredentialDescriptor { 37 29 required PublicKeyCredentialType type; -
trunk/Source/WebCore/PAL/ChangeLog
r236468 r236481 1 2018-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 1 13 2018-09-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 14 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r236468 r236481 114 114 570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; }; 115 115 570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */; }; 116 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */; };117 116 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; }; 118 117 7A3A6A8020CADB4700317AAE /* NSImageSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */; }; … … 269 268 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxySPI.h; sourceTree = "<group>"; }; 270 269 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>"; };272 270 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; }; 273 271 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSImageSPI.h; sourceTree = "<group>"; }; … … 377 375 0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */, 378 376 0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */, 379 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */,380 377 CE5673862151A7B9002F92D7 /* IOKitSPI.h */, 381 378 0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */, … … 666 663 0C5AF91A1F43A4C7002EAC02 /* DataDetectorsUISPI.h in Headers */, 667 664 A1175B571F6B470500C4B9F0 /* DefaultSearchProvider.h in Headers */, 668 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */,669 665 0C2D9E731EEF5AF600DBC317 /* ExportMacros.h in Headers */, 670 666 F44291601FA5261E002CC93E /* FileSizeFormatter.h in Headers */, -
trunk/Source/WebCore/Sources.txt
r236429 r236481 2429 2429 JSAuthenticatorAttestationResponse.cpp 2430 2430 JSAuthenticatorResponse.cpp 2431 JSAuthenticatorTransport.cpp 2431 2432 JSBarProp.cpp 2432 2433 JSBasicCredential.cpp -
trunk/Source/WebCore/SourcesCocoa.txt
r236445 r236481 26 26 Modules/plugins/QuickTimePluginReplacement.mm 27 27 Modules/plugins/YouTubePluginReplacement.cpp 28 Modules/webauthn/cocoa/LocalAuthenticator.mm29 28 Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm 30 29 … … 197 196 platform/cocoa/KeyEventCocoa.mm 198 197 platform/cocoa/LocalizedStringsCocoa.mm 199 platform/cocoa/LocalAuthenticationSoftLink.mm200 198 platform/cocoa/MIMETypeRegistryCocoa.mm 201 199 platform/cocoa/NetworkExtensionContentFilter.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r236445 r236481 1738 1738 571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; }; 1739 1739 572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */; }; 1740 57212152205365650062AA1F /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721214E20535D710062AA1F /* LocalAuthenticationSoftLink.h */; };1741 1740 5721A9871ECE53B10081295A /* CryptoDigestAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9861ECE53B10081295A /* CryptoDigestAlgorithm.h */; }; 1742 1741 5721A98B1ECE57040081295A /* CryptoAlgorithmRsaPssParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9881ECE57040081295A /* CryptoAlgorithmRsaPssParams.h */; }; … … 1763 1762 573489391DAC6B6E00DC0667 /* CryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 573489381DAC6B6D00DC0667 /* CryptoAlgorithmParameters.h */; }; 1764 1763 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, ); }; };1766 1764 574F55E1204F3B23002948C6 /* COSEConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 574F55DC204F3732002948C6 /* COSEConstants.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1767 1765 5750A9751E68D00000705C4A /* CryptoKeyEC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9731E68D00000705C4A /* CryptoKeyEC.h */; }; … … 1797 1795 57DCED69214077640016B847 /* JSMockAuthenticatorCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */; }; 1798 1796 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 */; }; 1799 1799 57E1E5A31E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E1E5A11E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h */; }; 1800 1800 57E1E5A71E8DBD3E00EE37C9 /* CryptoAlgorithmAesCtrParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E1E5A61E8DBD3E00EE37C9 /* CryptoAlgorithmAesCtrParams.h */; }; … … 8495 8495 572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesCbcCfbParams.idl; sourceTree = "<group>"; }; 8496 8496 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>"; };8499 8497 5721A9831ECE4FB90081295A /* CryptoAlgorithmRSA_PSSMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_PSSMac.cpp; sourceTree = "<group>"; }; 8500 8498 5721A9861ECE53B10081295A /* CryptoDigestAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoDigestAlgorithm.h; sourceTree = "<group>"; }; … … 8546 8544 574D42791D594FF6002CF50E /* GlobalCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GlobalCrypto.idl; sourceTree = "<group>"; }; 8547 8545 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>"; };8550 8546 574F55E2204F3CBF002948C6 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; }; 8551 8547 5750A9721E68D00000705C4A /* CryptoKeyEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyEC.cpp; sourceTree = "<group>"; }; … … 8623 8619 57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockAuthenticatorCoordinator.cpp; sourceTree = "<group>"; }; 8624 8620 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>"; }; 8625 8625 57E1E5A01E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CTR.cpp; sourceTree = "<group>"; }; 8626 8626 57E1E5A11E8C91B500EE37C9 /* CryptoAlgorithmAES_CTR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAES_CTR.h; sourceTree = "<group>"; }; … … 18837 18837 57303BCF20087A8300355965 /* AuthenticatorResponse.h */, 18838 18838 57303BD120087A8300355965 /* AuthenticatorResponse.idl */, 18839 57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */, 18840 57DCED8E21487EDB0016B847 /* AuthenticatorTransport.idl */, 18839 18841 574F55DC204F3732002948C6 /* COSEConstants.h */, 18840 18842 57D8462C1FEAF68F00CA3682 /* PublicKeyCredential.cpp */, … … 18863 18865 57303BDE20095B2700355965 /* JSAuthenticatorResponse.cpp */, 18864 18866 57303BDD20095B2600355965 /* JSAuthenticatorResponse.h */, 18867 57DCED91214880C60016B847 /* JSAuthenticatorTransport.cpp */, 18868 57DCED92214880C60016B847 /* JSAuthenticatorTransport.h */, 18865 18869 57D846311FEAFC2F00CA3682 /* JSPublicKeyCredential.cpp */, 18866 18870 57D846301FEAFC2F00CA3682 /* JSPublicKeyCredential.h */, … … 21693 21697 A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */, 21694 21698 A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */, 21695 5721214E20535D710062AA1F /* LocalAuthenticationSoftLink.h */,21696 57212150205361D20062AA1F /* LocalAuthenticationSoftLink.mm */,21697 21699 1A4832B21A953BA6008B4DFE /* LocalizedStringsCocoa.mm */, 21698 21700 C53D39331C97892D007F3AE9 /* MIMETypeRegistryCocoa.mm */, … … 27305 27307 5760827220215A5500116678 /* AuthenticatorCoordinatorClient.h in Headers */, 27306 27308 57303BD220087A8300355965 /* AuthenticatorResponse.h in Headers */, 27309 57DCED9021487FF70016B847 /* AuthenticatorTransport.h in Headers */, 27307 27310 A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */, 27308 27311 A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */, … … 28583 28586 57303C222009AF0300355965 /* JSAuthenticatorAttestationResponse.h in Headers */, 28584 28587 57303BE120095D6100355965 /* JSAuthenticatorResponse.h in Headers */, 28588 57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */, 28585 28589 BC124F000C26447A009E2349 /* JSBarProp.h in Headers */, 28586 28590 57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */, … … 29457 29461 51E6821016387302003BBF3C /* LoaderStrategy.h in Headers */, 29458 29462 8A12E35D11FA33280025836A /* LoadTiming.h in Headers */, 29459 57212152205365650062AA1F /* LocalAuthenticationSoftLink.h in Headers */,29460 574F55E0204F3ACE002948C6 /* LocalAuthenticator.h in Headers */,29461 29463 06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */, 29462 29464 445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */, -
trunk/Source/WebCore/dom/ExceptionData.h
r221198 r236481 35 35 String message; 36 36 37 ExceptionData isolatedCopy() const;37 WEBCORE_EXPORT ExceptionData isolatedCopy() const; 38 38 39 39 template<class Encoder> void encode(Encoder&) const; -
trunk/Source/WebCore/platform/cocoa/SharedBufferCocoa.mm
r232501 r236481 32 32 #include <wtf/MainThread.h> 33 33 34 using namespace WebCore;35 36 34 @interface WebCoreSharedBufferData : NSData 37 35 { 38 RefPtr<const SharedBuffer::DataSegment> sharedBufferDataSegment;36 RefPtr<const WebCore::SharedBuffer::DataSegment> sharedBufferDataSegment; 39 37 } 40 38 41 - (id)initWithSharedBufferDataSegment:(const SharedBuffer::DataSegment&)dataSegment;39 - (id)initWithSharedBufferDataSegment:(const WebCore::SharedBuffer::DataSegment&)dataSegment; 42 40 @end 43 41 … … 60 58 } 61 59 62 - (id)initWithSharedBufferDataSegment:(const SharedBuffer::DataSegment&)dataSegment60 - (id)initWithSharedBufferDataSegment:(const WebCore::SharedBuffer::DataSegment&)dataSegment 63 61 { 64 62 self = [super init]; -
trunk/Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm
r236088 r236481 46 46 #import <wtf/SoftLinking.h> 47 47 48 using namespace WebCore; 48 namespace WebCore { 49 49 50 50 VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement() … … 275 275 } 276 276 277 } // namespace WebCore 278 277 279 #endif -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm
r226976 r236481 34 34 #import <wtf/text/WTFString.h> 35 35 36 using namespace WebCore; 36 namespace WebCore { 37 37 38 38 static NSString * const WKExplicitBeginTimeFlag = @"WKPlatformCAAnimationExplicitBeginTimeFlag"; 39 39 40 bool WebCore::hasExplicitBeginTime(CAAnimation *animation)40 bool hasExplicitBeginTime(CAAnimation *animation) 41 41 { 42 42 return [[animation valueForKey:WKExplicitBeginTimeFlag] boolValue]; 43 43 } 44 44 45 void WebCore::setHasExplicitBeginTime(CAAnimation *animation, bool value)45 void setHasExplicitBeginTime(CAAnimation *animation, bool value) 46 46 { 47 47 [animation setValue:[NSNumber numberWithBool:value] forKey:WKExplicitBeginTimeFlag]; 48 48 } 49 49 50 NSString* WebCore::toCAFillModeType(PlatformCAAnimation::FillModeType type)50 NSString* toCAFillModeType(PlatformCAAnimation::FillModeType type) 51 51 { 52 52 switch (type) { … … 70 70 } 71 71 72 NSString* WebCore::toCAValueFunctionType(PlatformCAAnimation::ValueFunctionType type)72 NSString* toCAValueFunctionType(PlatformCAAnimation::ValueFunctionType type) 73 73 { 74 74 switch (type) { … … 127 127 } 128 128 129 CAMediaTimingFunction* WebCore::toCAMediaTimingFunction(const TimingFunction* timingFunction, bool reverse)129 CAMediaTimingFunction* toCAMediaTimingFunction(const TimingFunction* timingFunction, bool reverse) 130 130 { 131 131 ASSERT(timingFunction); … … 379 379 } 380 380 381 void PlatformCAAnimationCocoa::setFromValue(const WebCore::TransformationMatrix& value)381 void PlatformCAAnimationCocoa::setFromValue(const TransformationMatrix& value) 382 382 { 383 383 if (!isBasicAnimation()) … … 400 400 } 401 401 402 void PlatformCAAnimationCocoa::setFromValue(const WebCore::Color& value)402 void PlatformCAAnimationCocoa::setFromValue(const Color& value) 403 403 { 404 404 if (!isBasicAnimation()) … … 436 436 } 437 437 438 void PlatformCAAnimationCocoa::setToValue(const WebCore::TransformationMatrix& value)438 void PlatformCAAnimationCocoa::setToValue(const TransformationMatrix& value) 439 439 { 440 440 if (!isBasicAnimation()) … … 457 457 } 458 458 459 void PlatformCAAnimationCocoa::setToValue(const WebCore::Color& value)459 void PlatformCAAnimationCocoa::setToValue(const Color& value) 460 460 { 461 461 if (!isBasicAnimation()) … … 499 499 } 500 500 501 void PlatformCAAnimationCocoa::setValues(const Vector< WebCore::TransformationMatrix>& value)501 void PlatformCAAnimationCocoa::setValues(const Vector<TransformationMatrix>& value) 502 502 { 503 503 if (animationType() != Keyframe) … … 530 530 } 531 531 532 void PlatformCAAnimationCocoa::setValues(const Vector< WebCore::Color>& value)532 void PlatformCAAnimationCocoa::setValues(const Vector<Color>& value) 533 533 { 534 534 if (animationType() != Keyframe) … … 603 603 [static_cast<CAKeyframeAnimation*>(m_animation.get()) setTimingFunctions:[other timingFunctions]]; 604 604 } 605 606 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
r235586 r236481 34 34 #import <wtf/BlockObjCExceptions.h> 35 35 36 using namespace WebCore; 36 namespace WebCore { 37 37 38 38 // FIXME: Should share these values with CSSFilter::build() (https://bugs.webkit.org/show_bug.cgi?id=76008). … … 693 693 #endif 694 694 } 695 696 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
r235935 r236481 67 67 SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVPlayerLayer) 68 68 69 using namespace WebCore; 69 namespace WebCore { 70 70 71 71 Ref<PlatformCALayer> PlatformCALayerCocoa::create(LayerType layerType, PlatformCALayerClient* owner) … … 98 98 } 99 99 100 } // namespace WebCore 101 100 102 // Delegate for animationDidStart callback 101 103 @interface WebAnimationDelegate : NSObject { 102 PlatformCALayer* m_owner;104 WebCore::PlatformCALayer* m_owner; 103 105 } 104 106 105 107 - (void)animationDidStart:(CAAnimation *)anim; 106 - (void)setOwner:( PlatformCALayer*)owner;108 - (void)setOwner:(WebCore::PlatformCALayer*)owner; 107 109 108 110 @end … … 112 114 - (void)animationDidStart:(CAAnimation *)animation 113 115 { 116 using namespace WebCore; 114 117 #if PLATFORM(IOS) 115 118 WebThreadLock(); … … 142 145 - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished 143 146 { 147 using namespace WebCore; 144 148 #if PLATFORM(IOS) 145 149 WebThreadLock(); … … 164 168 } 165 169 166 - (void)setOwner:( PlatformCALayer*)owner170 - (void)setOwner:(WebCore::PlatformCALayer*)owner 167 171 { 168 172 m_owner = owner; … … 170 174 171 175 @end 176 177 namespace WebCore { 172 178 173 179 void PlatformCALayerCocoa::setOwner(PlatformCALayerClient* owner) … … 1263 1269 return nil; 1264 1270 } 1271 1272 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm
r192712 r236481 30 30 #import <QuartzCore/QuartzCore.h> 31 31 32 using namespace WebCore;33 34 32 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=146250 35 33 // These should provide the system recipes for the layers … … 52 50 53 51 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()]; 55 53 56 54 return self; … … 78 76 79 77 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()]; 81 79 82 80 return self; -
trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.mm
r212776 r236481 31 31 #import <wtf/MainThread.h> 32 32 33 using namespace WebCore;34 35 33 @implementation WebTiledBackingLayer 36 34 … … 62 60 } 63 61 64 - ( TileController*)createTileController:(PlatformCALayer*)rootLayer62 - (WebCore::TileController*)createTileController:(WebCore::PlatformCALayer*)rootLayer 65 63 { 66 64 ASSERT(!_tileController); … … 101 99 - (void)setNeedsDisplayInRect:(CGRect)rect 102 100 { 103 _tileController->setNeedsDisplayInRect( enclosingIntRect(rect));101 _tileController->setNeedsDisplayInRect(WebCore::enclosingIntRect(rect)); 104 102 } 105 103 … … 158 156 - (void)setBorderColor:(CGColorRef)borderColor 159 157 { 160 _tileController->setTileDebugBorderColor( Color(borderColor));158 _tileController->setTileDebugBorderColor(WebCore::Color(borderColor)); 161 159 } 162 160 -
trunk/Source/WebCore/testing/Internals.cpp
r236448 r236481 556 556 557 557 #if ENABLE(WEB_AUTHN) 558 // FIXME(189283) 558 559 if (document.page()) { 559 560 auto mockAuthenticatorCoordinator = std::make_unique<MockAuthenticatorCoordinator>(); 560 561 m_mockAuthenticatorCoordinator = makeWeakPtr(mockAuthenticatorCoordinator.get()); 561 document.page()->authenticatorCoordinator().setClient(WTFMove(mockAuthenticatorCoordinator));562 // document.page()->authenticatorCoordinator().setClient(WTFMove(mockAuthenticatorCoordinator)); 562 563 } 563 564 #endif -
trunk/Source/WebKit/CMakeLists.txt
r236477 r236481 52 52 "${WEBKIT_DIR}/UIProcess/Storage" 53 53 "${WEBKIT_DIR}/UIProcess/UserContent" 54 "${WEBKIT_DIR}/UIProcess/WebAuthentication" 55 "${WEBKIT_DIR}/UIProcess/WebAuthentication/Mock" 54 56 "${WEBKIT_DIR}/UIProcess/WebStorage" 55 57 "${WEBKIT_DIR}/UIProcess/WebsiteData" -
trunk/Source/WebKit/ChangeLog
r236480 r236481 1 2018-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 1 157 2018-09-25 Chris Dumez <cdumez@apple.com> 2 158 -
trunk/Source/WebKit/Configurations/WebKit.xcconfig
r236098 r236481 63 63 WK_CORE_SERVICES_LDFLAGS_macosx = -framework CoreServices; 64 64 65 WK_DEVICE_IDENTITY_LDFLAGS = $(WK_DEVICE_IDENTITY_LDFLAGS_$(WK_HAVE_DEVICE_IDENTITY)); 66 WK_DEVICE_IDENTITY_LDFLAGS_YES = -framework DeviceIdentity; 67 65 68 WK_GRAPHICS_SERVICES_LDFLAGS = $(WK_GRAPHICS_SERVICES_LDFLAGS_$(WK_COCOA_TOUCH)); 66 69 WK_GRAPHICS_SERVICES_LDFLAGS_cocoatouch = -framework GraphicsServices; … … 119 122 WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting; 120 123 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);124 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_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); 122 125 123 126 // Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols. … … 156 159 WK_RELOCATABLE_FRAMEWORK_LDFLAGS_YES = -Wl,-not_for_dyld_shared_cache; 157 160 161 WK_HAVE_DEVICE_IDENTITY = $(WK_HAVE_DEVICE_IDENTITY_$(PLATFORM_NAME)); 162 WK_HAVE_DEVICE_IDENTITY_iphoneos = YES; 163 158 164 WK_HAVE_URL_FORMATTING = $(WK_HAVE_URL_FORMATTING_$(WK_PLATFORM_NAME)); 159 165 WK_HAVE_URL_FORMATTING_iphoneos = $(WK_HAVE_URL_FORMATTING$(WK_IOS_12)); -
trunk/Source/WebKit/SourcesCocoa.txt
r236075 r236481 456 456 UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp 457 457 458 UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm 459 UIProcess/WebAuthentication/Cocoa/LocalConnection.mm 460 UIProcess/WebAuthentication/Cocoa/LocalService.mm 461 462 UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp 463 UIProcess/WebAuthentication/Mock/MockLocalConnection.mm 464 UIProcess/WebAuthentication/Mock/MockLocalService.cpp 465 466 UIProcess/WebAuthentication/AuthenticatorManager.cpp 467 UIProcess/WebAuthentication/AuthenticatorTransportService.cpp 468 UIProcess/WebAuthentication/Authenticator.cpp 458 469 UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 459 470 -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
r236320 r236481 29 29 #include "APIArray.h" 30 30 #include "APIWebsiteDataStore.h" 31 #include "MockWebAuthenticationConfiguration.h" 31 32 #include "WKAPICast.h" 33 #include "WKDictionary.h" 34 #include "WKNumber.h" 35 #include "WKRetainPtr.h" 32 36 #include "WKSecurityOriginRef.h" 33 37 #include "WKString.h" … … 567 571 WebKit::toImpl(dataStoreRef)->websiteDataStore().setServiceWorkerRegistrationDirectory(WebKit::toImpl(serviceWorkerRegistrationDirectory)->string()); 568 572 } 573 574 575 void 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 115 115 WK_EXPORT void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef, WKStringRef serviceWorkerRegistrationDirectory); 116 116 117 WK_EXPORT void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configuration); 118 117 119 #ifdef __cplusplus 118 120 } -
trunk/Source/WebKit/UIProcess/WebAuthentication/Authenticator.cpp
r236480 r236481 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "Authenticator.h" 27 28 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 29 #if ENABLE(WEB_AUTHN) 30 30 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 31 #include <wtf/RunLoop.h> 32 32 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 33 namespace WebKit { 34 35 void 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 49 void 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 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "WebAuthenticationRequestData.h" 31 #include <WebCore/ExceptionData.h> 32 #include <WebCore/PublicKeyCredentialData.h> 30 33 #include <wtf/Forward.h> 31 #include <wtf/ Noncopyable.h>34 #include <wtf/RefCounted.h> 32 35 #include <wtf/WeakPtr.h> 33 36 34 namespace Web Core{37 namespace WebKit { 35 38 36 struct ExceptionData; 37 struct PublicKeyCredentialCreationOptions; 38 struct PublicKeyCredentialData; 39 struct PublicKeyCredentialRequestOptions; 39 class Authenticator : public RefCounted<Authenticator>, public CanMakeWeakPtr<Authenticator> { 40 public: 41 using Respond = Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>; 40 42 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 }; 42 48 43 typedef void (^CompletionBlock)(SecKeyRef _Nullable referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error);49 virtual ~Authenticator() = default; 44 50 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); } 51 52 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&); 55 55 56 56 protected: 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 64 private: 65 virtual void makeCredential() = 0; 66 virtual void getAssertion() = 0; 67 68 WeakPtr<Observer> m_observer; 69 WebAuthenticationRequestData m_pendingRequestData; 59 70 }; 60 71 61 } // namespace Web Core72 } // namespace WebKit 62 73 63 74 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
r236480 r236481 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "AuthenticatorTransportService.h" 27 28 28 29 #if ENABLE(WEB_AUTHN) 29 30 30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 31 #include "LocalService.h" 32 #include "MockLocalService.h" 33 #include <wtf/RunLoop.h> 31 34 32 #if USE(APPLE_INTERNAL_SDK) 35 namespace WebKit { 33 36 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> 37 UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::create(WebCore::AuthenticatorTransport transport, Observer& observer) 38 { 39 ASSERT(transport == WebCore::AuthenticatorTransport::Internal); 40 return makeUniqueRef<LocalService>(observer); 40 41 } 41 42 42 #else 43 UniqueRef<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 } 43 48 44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error); 49 AuthenticatorTransportService::AuthenticatorTransportService(Observer& observer) 50 : m_observer(makeWeakPtr(observer)) 51 { 52 } 45 53 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; 54 void 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 } 55 63 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 62 65 63 66 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h
r236480 r236481 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 30 #include <WebCore/AuthenticatorTransport.h> 31 #include <wtf/UniqueRef.h> 32 #include <wtf/WeakPtr.h> 31 33 32 #if USE(APPLE_INTERNAL_SDK) 34 namespace WebKit { 33 35 34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300 35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls; 36 #endif 36 class Authenticator; 37 37 38 extern "C" { 39 #import <DeviceIdentity/DeviceIdentity.h> 40 } 38 struct MockWebAuthenticationConfiguration; 41 39 42 #else 40 class AuthenticatorTransportService : public CanMakeWeakPtr<AuthenticatorTransportService> { 41 WTF_MAKE_FAST_ALLOCATED; 42 WTF_MAKE_NONCOPYABLE(AuthenticatorTransportService); 43 public: 44 class Observer : public CanMakeWeakPtr<Observer> { 45 public: 46 virtual ~Observer() = default; 43 47 44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error); 48 virtual void authenticatorAdded(Ref<Authenticator>&&) = 0; 49 }; 45 50 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&); 55 53 56 extern "C" 57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull); 54 virtual ~AuthenticatorTransportService() = default; 58 55 59 #endif // USE(APPLE_INTERNAL_SDK) 56 // This operation is guaranteed to execute asynchronously. 57 void startDiscovery() const; 60 58 61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 59 protected: 60 explicit AuthenticatorTransportService(Observer&); 61 62 Observer* observer() const { return m_observer.get(); } 63 64 private: 65 virtual void startDiscoveryInternal() const = 0; 66 67 WeakPtr<Observer> m_observer; 68 }; 69 70 } // namespace WebKit 62 71 63 72 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h
r236480 r236481 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h>29 28 #import <wtf/SoftLinking.h> 30 29 31 SOFT_LINK_FRAMEWORK _FOR_HEADER(WebCore, LocalAuthentication)30 SOFT_LINK_FRAMEWORK(LocalAuthentication); 32 31 33 SOFT_LINK_CLASS _FOR_HEADER(WebCore, LocalAuthentication, LAContext)32 SOFT_LINK_CLASS(LocalAuthentication, LAContext); -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h
r236480 r236481 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 30 #include "Authenticator.h" 31 #include "LocalConnection.h" 32 #include <wtf/UniqueRef.h> 31 33 32 #if USE(APPLE_INTERNAL_SDK) 34 OBJC_CLASS LAContext; 33 35 34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300 35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls; 36 #endif 36 namespace WebKit { 37 37 38 extern "C" { 39 #import <DeviceIdentity/DeviceIdentity.h> 40 } 38 class LocalAuthenticator final : public Authenticator { 39 public: 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 }; 41 49 42 #else 50 static Ref<LocalAuthenticator> create(UniqueRef<LocalConnection>&& connection) 51 { 52 return adoptRef(*new LocalAuthenticator(WTFMove(connection))); 53 } 43 54 44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error); 55 private: 56 explicit LocalAuthenticator(UniqueRef<LocalConnection>&&); 45 57 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 *); 55 61 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); 58 64 59 #endif // USE(APPLE_INTERNAL_SDK) 65 State m_state { State::Init }; 66 UniqueRef<LocalConnection> m_connection; 67 }; 60 68 61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 69 } // namespace WebKit 62 70 63 71 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.h
r236480 r236481 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #i f PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)30 #include <wtf/CompletionHandler.h> 31 31 32 #if USE(APPLE_INTERNAL_SDK) 32 OBJC_CLASS LAContext; 33 33 34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300 35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls; 36 #endif 34 namespace WebKit { 37 35 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. 41 class LocalConnection { 42 WTF_MAKE_FAST_ALLOCATED; 43 WTF_MAKE_NONCOPYABLE(LocalConnection); 44 public: 45 enum class UserConsent { 46 No, 47 Yes 48 }; 41 49 42 #else 50 using AttestationCallback = CompletionHandler<void(SecKeyRef, NSArray *, NSError *)>; 51 using UserConsentCallback = CompletionHandler<void(UserConsent)>; 52 using UserConsentContextCallback = CompletionHandler<void(UserConsent, LAContext *)>; 43 53 44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error); 54 LocalConnection() = default; 55 virtual ~LocalConnection() = default; 45 56 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 }; 55 62 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 62 64 63 65 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h
r236480 r236481 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include "AuthenticatorTransportService.h" 32 31 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 32 namespace WebKit { 33 34 class LocalConnection; 35 36 class LocalService : public AuthenticatorTransportService { 37 public: 38 explicit LocalService(Observer&); 39 40 static bool isAvailable(); 41 42 private: 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 24 24 */ 25 25 26 #pragma once 26 #import "config.h" 27 #import "LocalService.h" 27 28 28 29 #if ENABLE(WEB_AUTHN) 29 30 30 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 31 #import "LocalAuthenticator.h" 32 #import "LocalConnection.h" 31 33 32 #i f USE(APPLE_INTERNAL_SDK)34 #import "LocalAuthenticationSoftLink.h" 33 35 34 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 110300 35 extern NSString * _Nonnull const kMAOptionsBAAAccessControls; 36 #endif 36 namespace WebKit { 37 37 38 extern "C" { 39 #import <DeviceIdentity/DeviceIdentity.h> 38 LocalService::LocalService(Observer& observer) 39 : AuthenticatorTransportService(observer) 40 { 40 41 } 41 42 43 bool LocalService::isAvailable() 44 { 45 // FIXME(182772) 46 #if !PLATFORM(IOS) 47 return false; 42 48 #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 } 43 58 44 typedef void (^MABAACompletionBlock)(_Nullable SecKeyRef referenceKey, NSArray * _Nullable certificates, NSError * _Nullable error); 59 void LocalService::startDiscoveryInternal() const 60 { 61 if (!platformStartDiscovery()) 62 return; 45 63 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 } 55 67 56 extern "C" 57 void DeviceIdentityIssueClientCertificateWithCompletion(dispatch_queue_t _Nullable, NSDictionary * _Nullable options, MABAACompletionBlock _Nonnull); 68 bool LocalService::platformStartDiscovery() const 69 { 70 return LocalService::isAvailable(); 71 } 58 72 59 #endif // USE(APPLE_INTERNAL_SDK) 73 UniqueRef<LocalConnection> LocalService::createLocalConnection() const 74 { 75 return makeUniqueRef<LocalConnection>(); 76 } 60 77 61 #endif // PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR) 78 } // namespace WebKit 62 79 63 80 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
r236480 r236481 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "MockAuthenticatorManager.h" 27 28 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 29 #if ENABLE(WEB_AUTHN) 30 30 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 31 namespace WebKit { 32 32 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 33 MockAuthenticatorManager::MockAuthenticatorManager(MockWebAuthenticationConfiguration&& configuration) 34 : m_testConfiguration(WTFMove(configuration)) 35 { 36 } 37 38 UniqueRef<AuthenticatorTransportService> MockAuthenticatorManager::createService(WebCore::AuthenticatorTransport transport, AuthenticatorTransportService::Observer& observer) const 39 { 40 return AuthenticatorTransportService::createMock(transport, observer, m_testConfiguration); 41 } 42 43 void 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 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include "AuthenticatorManager.h" 31 #include "MockWebAuthenticationConfiguration.h" 32 32 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 33 namespace WebKit { 34 35 class MockAuthenticatorManager final : public AuthenticatorManager { 36 public: 37 explicit MockAuthenticatorManager(MockWebAuthenticationConfiguration&&); 38 39 bool isMock() const final { return true; } 40 void setTestConfiguration(MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); } 41 42 private: 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 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include "LocalConnection.h" 31 #include "MockWebAuthenticationConfiguration.h" 32 32 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 33 namespace WebKit { 34 35 class MockLocalConnection final : public LocalConnection { 36 public: 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 43 private: 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 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "MockLocalService.h" 27 28 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 29 #if ENABLE(WEB_AUTHN) 30 30 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 31 #import "LocalAuthenticator.h" 32 #import "MockLocalConnection.h" 33 #import <wtf/RunLoop.h> 32 34 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 35 namespace WebKit { 36 37 MockLocalService::MockLocalService(Observer& observer, const MockWebAuthenticationConfiguration& configuration) 38 : LocalService(observer) 39 , m_configuration(configuration) 40 { 41 } 42 43 bool MockLocalService::platformStartDiscovery() const 44 { 45 // FIXME(189642): we should test false case. 46 return true; 47 } 48 49 UniqueRef<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 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include "LocalService.h" 31 #include "MockWebAuthenticationConfiguration.h" 32 32 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 33 namespace WebKit { 34 35 struct MockWebAuthenticationConfiguration; 36 37 class MockLocalService final : public LocalService { 38 public: 39 MockLocalService(Observer&, const MockWebAuthenticationConfiguration&); 40 41 private: 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 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 namespace WebKit { 32 31 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 32 struct 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 26 26 #pragma once 27 27 28 #import <LocalAuthentication/LocalAuthentication.h> 29 #import <wtf/SoftLinking.h> 28 #if ENABLE(WEB_AUTHN) 30 29 31 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, LocalAuthentication) 30 #include <WebCore/PublicKeyCredentialCreationOptions.h> 31 #include <WebCore/PublicKeyCredentialRequestOptions.h> 32 #include <wtf/Vector.h> 32 33 33 SOFT_LINK_CLASS_FOR_HEADER(WebCore, LocalAuthentication, LAContext) 34 namespace WebKit { 35 36 struct 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 29 29 #if ENABLE(WEB_AUTHN) 30 30 31 #include "AuthenticatorManager.h" 32 #include "LocalService.h" 31 33 #include "WebAuthenticatorCoordinatorMessages.h" 32 34 #include "WebAuthenticatorCoordinatorProxyMessages.h" 33 35 #include "WebPageProxy.h" 34 36 #include "WebProcessProxy.h" 37 #include "WebsiteDataStore.h" 35 38 #include <WebCore/ExceptionData.h> 36 #include <WebCore/LocalAuthenticator.h>37 39 #include <WebCore/PublicKeyCredentialData.h> 40 #include <wtf/MainThread.h> 38 41 39 42 namespace WebKit { … … 43 46 { 44 47 m_webPageProxy.process().addMessageReceiver(Messages::WebAuthenticatorCoordinatorProxy::messageReceiverName(), m_webPageProxy.pageID(), *this); 45 m_authenticator = std::make_unique<WebCore::LocalAuthenticator>();46 48 } 47 49 … … 53 55 void WebAuthenticatorCoordinatorProxy::makeCredential(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options) 54 56 { 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.61 57 auto callback = [weakThis = makeWeakPtr(*this)] (Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>&& result) { 58 ASSERT(RunLoop::isMain()); 62 59 if (!weakThis) 63 60 return; … … 69 66 }); 70 67 }; 71 m_ authenticator->makeCredential(hash, options, WTFMove(callback));68 m_webPageProxy.websiteDataStore().authenticatorManager().makeCredential(hash, options, WTFMove(callback)); 72 69 } 73 70 74 71 void WebAuthenticatorCoordinatorProxy::getAssertion(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options) 75 72 { 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.80 73 auto callback = [weakThis = makeWeakPtr(*this)] (Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>&& result) { 74 ASSERT(RunLoop::isMain()); 81 75 if (!weakThis) 82 76 return; … … 88 82 }); 89 83 }; 90 m_ authenticator->getAssertion(hash, options, WTFMove(callback));84 m_webPageProxy.websiteDataStore().authenticatorManager().getAssertion(hash, options, WTFMove(callback)); 91 85 } 92 86 93 87 void WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable(uint64_t messageId) 94 88 { 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())); 100 90 } 101 91 … … 105 95 } 106 96 107 void WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply(uint64_t messageId, bool result)108 {109 m_webPageProxy.send(Messages::WebAuthenticatorCoordinator::IsUserVerifyingPlatformAuthenticatorAvailableReply(messageId, result));110 }111 112 97 } // namespace WebKit 113 98 -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h
r235888 r236481 34 34 35 35 namespace WebCore { 36 class LocalAuthenticator;37 38 36 struct ExceptionData; 39 37 struct PublicKeyCredentialCreationOptions; … … 63 61 // Senders. 64 62 void requestReply(const WebCore::PublicKeyCredentialData&, const WebCore::ExceptionData&); 65 void isUserVerifyingPlatformAuthenticatorAvailableReply(uint64_t messageId, bool);66 63 67 64 WebPageProxy& m_webPageProxy; 68 std::unique_ptr<WebCore::LocalAuthenticator> m_authenticator;69 65 }; 70 66 -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r236477 r236481 30 30 #include "APIWebsiteDataRecord.h" 31 31 #include "APIWebsiteDataStore.h" 32 #include "AuthenticatorManager.h" 33 #include "MockAuthenticatorManager.h" 32 34 #include "NetworkProcessMessages.h" 33 35 #include "StorageManager.h" … … 97 99 , m_storageManager(StorageManager::create(m_configuration.localStorageDirectory)) 98 100 , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore")) 101 #if ENABLE(WEB_AUTHN) 102 , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) 103 #endif 99 104 { 100 105 WTF::setProcessPrivileges(allPrivileges()); … … 109 114 , m_configuration() 110 115 , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore")) 116 #if ENABLE(WEB_AUTHN) 117 , m_authenticatorManager(makeUniqueRef<AuthenticatorManager>()) 118 #endif 111 119 { 112 120 maybeRegisterWithSessionIDMap(); … … 1652 1660 #endif 1653 1661 1654 } 1662 #if ENABLE(WEB_AUTHN) 1663 void 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 38 38 #include <wtf/RefCounted.h> 39 39 #include <wtf/RefPtr.h> 40 #include <wtf/UniqueRef.h> 40 41 #include <wtf/WeakPtr.h> 41 42 #include <wtf/WorkQueue.h> … … 52 53 namespace WebKit { 53 54 55 class AuthenticatorManager; 54 56 class SecKeyProxyStore; 55 57 class StorageManager; … … 59 61 enum class WebsiteDataFetchOption; 60 62 enum class WebsiteDataType; 63 struct MockWebAuthenticationConfiguration; 61 64 struct StorageProcessCreationParameters; 62 65 struct WebsiteDataRecord; … … 190 193 #endif 191 194 195 #if ENABLE(WEB_AUTHN) 196 AuthenticatorManager& authenticatorManager() { return m_authenticatorManager.get(); } 197 void setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&&); 198 #endif 199 192 200 private: 193 201 explicit WebsiteDataStore(PAL::SessionID); … … 248 256 Vector<Ref<SecKeyProxyStore>> m_secKeyProxyStores; 249 257 #endif 258 259 #if ENABLE(WEB_AUTHN) 260 UniqueRef<AuthenticatorManager> m_authenticatorManager; 261 #endif 250 262 }; 251 263 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r236477 r236481 1029 1029 53DEA3661DDE423100E82648 /* json.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 53DEA3651DDE422E00E82648 /* json.hpp */; }; 1030 1030 570AB8F320AE3BD700B8BE87 /* SecKeyProxyStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F220AE3BD700B8BE87 /* SecKeyProxyStore.h */; }; 1031 578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; }; 1031 1032 57B4B46020B504AC00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B4B45E20B504AB00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h */; }; 1032 1033 57DCED6E2142EE5E0016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */; }; … … 1034 1035 57DCED702142EE680016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6C2142EAF90016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp */; }; 1035 1036 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 */; }; 1036 1050 5C0B17781E7C880E00E9123C /* NetworkSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */; }; 1037 1051 5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */; }; … … 3380 3394 57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticatorCoordinatorProxy.cpp; sourceTree = "<group>"; }; 3381 3395 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>"; }; 3382 3397 57B4B45D20B504AB00D4AD79 /* AuthenticationManagerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AuthenticationManagerCocoa.mm; path = Authentication/cocoa/AuthenticationManagerCocoa.mm; sourceTree = "<group>"; }; 3383 3398 57B4B45E20B504AB00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClientCertificateAuthenticationXPCConstants.h; path = Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h; sourceTree = "<group>"; }; … … 3386 3401 57DCED6C2142EAF90016B847 /* WebAuthenticatorCoordinatorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticatorCoordinatorProxyMessageReceiver.cpp; sourceTree = "<group>"; }; 3387 3402 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>"; }; 3388 3424 5C0B17741E7C879C00E9123C /* NetworkSocketStreamMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkSocketStreamMessageReceiver.cpp; sourceTree = "<group>"; }; 3389 3425 5C0B17751E7C879C00E9123C /* NetworkSocketStreamMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkSocketStreamMessages.h; sourceTree = "<group>"; }; … … 5912 5948 37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */, 5913 5949 A1FB68261F6E51C100C43F9F /* CrashReporterClientSPI.h */, 5950 57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */, 5914 5951 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */, 5915 5952 37B47E2C1D64DB76005F4EFF /* objcSPI.h */, … … 6736 6773 isa = PBXGroup; 6737 6774 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 */, 6738 6784 57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */, 6739 6785 57608295202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.h */, … … 6750 6796 ); 6751 6797 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; 6752 6826 sourceTree = "<group>"; 6753 6827 }; … … 8896 8970 518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */, 8897 8971 512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */, 8972 57DCEDB1214C60480016B847 /* Authenticator.h in Headers */, 8973 57DCEDAF214C603B0016B847 /* AuthenticatorManager.h in Headers */, 8974 57DCEDB0214C60420016B847 /* AuthenticatorTransportService.h in Headers */, 8898 8975 7CD102DA1866770600ED429D /* AutoCorrectionCallback.h in Headers */, 8899 8976 9955A6EF1C79810800EB6A93 /* Automation.json in Headers */, … … 8931 9008 1AC75380183BE50F0072CB15 /* DataReference.h in Headers */, 8932 9009 BC032DA610F437D10058C15A /* Decoder.h in Headers */, 9010 57DCEDAB214C60090016B847 /* DeviceIdentitySPI.h in Headers */, 8933 9011 83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */, 8934 9012 C18173612058424700DFDA65 /* DisplayLink.h in Headers */, … … 9017 9095 413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */, 9018 9096 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 */, 9019 9101 1A1D8BA21731A36300141DA4 /* LocalStorageDatabase.h in Headers */, 9020 9102 1A8C728D1738477C000A6554 /* LocalStorageDatabaseTracker.h in Headers */, … … 9031 9113 1AAB037A185A7C6A00EDF501 /* MessageSender.h in Headers */, 9032 9114 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 */, 9033 9119 C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */, 9034 9120 2D50366B1BCDE17900E20BB3 /* NativeWebGestureEvent.h in Headers */, … … 9274 9360 1A8E7D3D18C15149005A702A /* VisitedLinkTableControllerMessages.h in Headers */, 9275 9361 CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */, 9362 57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */, 9276 9363 57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */, 9364 57DCEDB3214C60530016B847 /* WebAuthenticatorCoordinatorProxy.h in Headers */, 9277 9365 57DCED712142EE6C0016B847 /* WebAuthenticatorCoordinatorProxyMessages.h in Headers */, 9278 9366 9955A6EC1C7980C200EB6A93 /* WebAutomationSession.h in Headers */, -
trunk/Tools/ChangeLog
r236477 r236481 1 2018-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 1 35 2018-09-25 Sihui Liu <sihui_liu@apple.com> 2 36 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r235878 r236481 42 42 0F2C20B81DCD545000542D9E /* Time.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F2C20B71DCD544800542D9E /* Time.cpp */; }; 43 43 0F30CB5C1FCE1796004B5323 /* ConcurrentPtrHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30CB5B1FCE1792004B5323 /* ConcurrentPtrHashSet.cpp */; }; 44 4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; };45 44 0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */; }; 46 45 0F4FFA9E1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */; }; … … 175 174 46E66A901F0D75590026D83C /* WKWebViewDiagnosticLogging.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46E66A8F1F0D75590026D83C /* WKWebViewDiagnosticLogging.mm */; }; 176 175 46E816F81E79E29C00375ADC /* RestoreStateAfterTermination.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46E816F71E79E29100375ADC /* RestoreStateAfterTermination.mm */; }; 176 4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; }; 177 177 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; }; 178 178 510477721D298DDD009747EB /* IDBDeleteRecovery.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5104776F1D298D85009747EB /* IDBDeleteRecovery.sqlite3 */; }; … … 245 245 57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAB2006C55400355965 /* CBORWriterTest.cpp */; }; 246 246 57303BCB2008376500355965 /* CBORReaderTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BC220071E2200355965 /* CBORReaderTest.cpp */; }; 247 574F55CF204D37C5002948C6 /* LocalAuthenticator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 574F55CE204D3763002948C6 /* LocalAuthenticator.mm */; };248 247 574F55D2204D47F0002948C6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 574F55D0204D471C002948C6 /* Security.framework */; }; 249 248 57599E211F07191900A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */; }; … … 935 934 dstSubfolderSpec = 7; 936 935 files = ( 937 C944160021430E8900B1EDDA /* audio-with-controls.html in Copy Resources */,938 936 1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */, 939 937 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */, … … 952 950 37137E4B21124D01002BEEA4 /* AttrStyle.html in Copy Resources */, 953 951 CD9E292E1C90C33F000BB800 /* audio-only.html in Copy Resources */, 952 C944160021430E8900B1EDDA /* audio-with-controls.html in Copy Resources */, 954 953 CD57779C211CE91F001B371E /* audio-with-web-audio.html in Copy Resources */, 955 954 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */, … … 1239 1238 0F2C20B71DCD544800542D9E /* Time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Time.cpp; sourceTree = "<group>"; }; 1240 1239 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>"; };1242 1240 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEvaluateJavaScript.mm; sourceTree = "<group>"; }; 1243 1241 0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SnapshotViaRenderInContext.mm; sourceTree = "<group>"; }; … … 1542 1540 57303BC220071E2200355965 /* CBORReaderTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORReaderTest.cpp; sourceTree = "<group>"; }; 1543 1541 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>"; };1545 1542 574F55D0204D471C002948C6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 1546 1543 57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBStructuredCloneBackwardCompatibility.mm; sourceTree = "<group>"; }; … … 2022 2019 E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; }; 2023 2020 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>"; }; 2024 2022 ECA680CD1E68CC0900731D20 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; }; 2025 2023 F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; }; … … 2555 2553 F4BC0B132146C849002A0478 /* FocusPreservationTests.mm */, 2556 2554 F45E15722112CE2900307E82 /* KeyboardInputTestsIOS.mm */, 2557 574F55CE204D3763002948C6 /* LocalAuthenticator.mm */,2558 2555 7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */, 2559 2556 F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */, … … 2622 2619 isa = PBXGroup; 2623 2620 children = ( 2624 C94415FF21430B6700B1EDDA /* audio-with-controls.html */,2625 2621 C25CCA0C1E5140E50026CB8A /* AllAhem.svg */, 2626 2622 F4A9202E1FEE34C800F59590 /* apple-data-url.html */, … … 2631 2627 F4856CA21E6498A8009D7EE7 /* attachment-element.html */, 2632 2628 3760C4F221124BD000233ACC /* AttrStyle.html */, 2629 C94415FF21430B6700B1EDDA /* audio-with-controls.html */, 2633 2630 CD57779A211CE6B7001B371E /* audio-with-web-audio.html */, 2634 2631 F41AB9981EF4692C0083FA08 /* autofocus-contenteditable.html */, … … 3864 3861 7C83E0C01D0A652700FEBCF3 /* LoadInvalidURLRequest.mm in Sources */, 3865 3862 7CCE7F001A411AE600447C4C /* LoadPageOnCrash.cpp in Sources */, 3866 574F55CF204D37C5002948C6 /* LocalAuthenticator.mm in Sources */,3867 3863 51E6A8941D2F1C0A00C004B6 /* LocalStorageClear.mm in Sources */, 3868 3864 CA38459620AE17A900990D3B /* LocalStorageDatabaseTracker.mm in Sources */, -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r236216 r236481 352 352 353 353 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); 354 360 }; -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r236216 r236481 2349 2349 } 2350 2350 2351 // WebAuthN 2352 void 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 2422 void 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 2452 void 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 2460 bool 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 2351 2489 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r236216 r236481 469 469 void sendDisplayConfigurationChangedMessageForTesting(); 470 470 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 471 478 private: 472 479 TestRunner(); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r236216 r236481 3169 3169 } 3170 3170 3171 void TestController::addTestKeyToKeychain(const String&, const String&, const String&) 3172 { 3173 } 3174 3175 void TestController::cleanUpKeychain(const String&) 3176 { 3177 } 3178 3179 bool TestController::keyExistsInKeychain(const String&, const String&) 3180 { 3181 } 3171 3182 #endif 3172 3183 … … 3176 3187 } 3177 3188 3189 void TestController::setWebAuthenticationMockConfiguration(WKDictionaryRef configuration) 3190 { 3191 WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKContextGetWebsiteDataStore(platformContext()), configuration); 3192 } 3193 3178 3194 } // namespace WTR -
trunk/Tools/WebKitTestRunner/TestController.h
r236216 r236481 255 255 void sendDisplayConfigurationChangedMessageForTesting(); 256 256 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 257 262 private: 258 263 WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r236216 r236481 1453 1453 } 1454 1454 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 1455 1499 ASSERT_NOT_REACHED(); 1456 1500 return nullptr; -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r236303 r236481 91 91 5664A49A14326384008881BE /* TextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5664A49814326384008881BE /* TextInputController.cpp */; }; 92 92 5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5670B8271386FCA5002EB355 /* EventSenderProxy.mm */; }; 93 570E75A82152DB4F00324B6E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570E75A42152DA2C00324B6E /* Security.framework */; }; 93 94 6510A78211EC643800410867 /* AHEM____.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77711EC643800410867 /* AHEM____.TTF */; }; 94 95 6510A78411EC643800410867 /* WebKitWeightWatcher100.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77911EC643800410867 /* WebKitWeightWatcher100.ttf */; }; … … 298 299 5670B8261386FC13002EB355 /* EventSenderProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSenderProxy.h; sourceTree = "<group>"; }; 299 300 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; }; 300 302 583913D014335E95008307E5 /* JSAccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAccessibilityController.cpp; sourceTree = "<group>"; }; 301 303 583913D114335E95008307E5 /* JSAccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAccessibilityController.h; sourceTree = "<group>"; }; … … 386 388 buildActionMask = 2147483647; 387 389 files = ( 390 570E75A82152DB4F00324B6E /* Security.framework in Frameworks */, 388 391 ); 389 392 runOnlyForDeploymentPostprocessing = 0; … … 635 638 2EE52CE21890A9A80010ED21 /* Foundation.framework */, 636 639 0F73B5571BA7929E004B3EF4 /* JavaScriptCore.framework */, 640 570E75A42152DA2C00324B6E /* Security.framework */, 637 641 ); 638 642 name = Frameworks; -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r235837 r236481 33 33 #import "TestRunnerWKWebView.h" 34 34 #import <Foundation/Foundation.h> 35 #import <Security/SecItem.h> 35 36 #import <WebKit/WKContextConfigurationRef.h> 36 37 #import <WebKit/WKCookieManager.h> … … 292 293 } 293 294 295 void 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 323 void 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 335 bool 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 294 353 } // namespace WTR
Note:
See TracChangeset
for help on using the changeset viewer.