Changeset 286746 in webkit
- Timestamp:
- Dec 8, 2021, 3:49:16 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r286709 r286746 1 2021-12-08 J Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Consider support for the displayName for FIDO authenticator 4 https://bugs.webkit.org/show_bug.cgi?id=233389 5 rdar://84938707 6 7 Reviewed by Brent Fulgham. 8 9 Start storing the displayName field with the platform authenticator 10 and add them to the getAllLocalAuthenticatorCredentials SPI. 11 12 The displayName is part of the WebAuthn level 2 spec: 13 https://www.w3.org/TR/webauthn-2/#dom-publickeycredentialuserentity-displayname 14 15 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: 16 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: 17 (getAllLocalAuthenticatorCredentialsImpl): 18 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 19 (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): 20 1 21 2021-12-08 Truitt Savell <tsavell@apple.com> 2 22 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h
r286078 r286746 88 88 89 89 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialNameKey; 90 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialDisplayNameKey; 90 91 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialIDKey; 91 92 WK_EXPORT extern NSString * const _WKLocalAuthenticatorCredentialRelyingPartyIDKey; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm
r285965 r286746 101 101 102 102 NSString * const _WKLocalAuthenticatorCredentialNameKey = @"_WKLocalAuthenticatorCredentialNameKey"; 103 NSString * const _WKLocalAuthenticatorCredentialDisplayNameKey = @"_WKLocalAuthenticatorCredentialDisplayNameKey"; 103 104 NSString * const _WKLocalAuthenticatorCredentialIDKey = @"_WKLocalAuthenticatorCredentialIDKey"; 104 105 NSString * const _WKLocalAuthenticatorCredentialRelyingPartyIDKey = @"_WKLocalAuthenticatorCredentialRelyingPartyIDKey"; … … 266 267 } 267 268 auto& username = it->second.getString(); 268 269 [result addObject:@{ 270 _WKLocalAuthenticatorCredentialNameKey: username, 271 _WKLocalAuthenticatorCredentialIDKey: attributes[bridge_cast(kSecAttrApplicationLabel)], 272 _WKLocalAuthenticatorCredentialRelyingPartyIDKey: attributes[bridge_cast(kSecAttrLabel)], 273 _WKLocalAuthenticatorCredentialLastModificationDateKey: attributes[bridge_cast(kSecAttrModificationDate)], 274 _WKLocalAuthenticatorCredentialCreationDateKey: attributes[bridge_cast(kSecAttrCreationDate)] 275 }]; 269 auto credential = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: 270 username, _WKLocalAuthenticatorCredentialNameKey, 271 attributes[bridge_cast(kSecAttrApplicationLabel)], _WKLocalAuthenticatorCredentialIDKey, 272 attributes[bridge_cast(kSecAttrLabel)], _WKLocalAuthenticatorCredentialRelyingPartyIDKey, 273 attributes[bridge_cast(kSecAttrModificationDate)], _WKLocalAuthenticatorCredentialLastModificationDateKey, 274 attributes[bridge_cast(kSecAttrCreationDate)], _WKLocalAuthenticatorCredentialCreationDateKey, 275 nil 276 ]); 277 278 it = responseMap.find(cbor::CBORValue(fido::kDisplayNameMapKey)); 279 if (it != responseMap.end() && it->second.isString()) 280 [credential setObject:it->second.getString() forKey:_WKLocalAuthenticatorCredentialDisplayNameKey]; 281 282 [result addObject:credential.get()]; 276 283 } 277 284 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r285698 r286746 348 348 // kSecAttrLabel: RP ID 349 349 // kSecAttrApplicationLabel: Credential ID (auto-gen by Keychain) 350 // kSecAttrApplicationTag: { "id": UserEntity.id, "name": UserEntity.name 350 // kSecAttrApplicationTag: { "id": UserEntity.id, "name": UserEntity.name, "displayName": UserEntity.name} (CBOR encoded) 351 351 // Noted, the vale of kSecAttrApplicationLabel is automatically generated by the Keychain, which is a SHA-1 hash of 352 352 // the public key. 353 353 const auto& secAttrLabel = creationOptions.rp.id; 354 354 355 // id, name, and displayName are required in PublicKeyCredentialUserEntity 356 // https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialuserentity 355 357 cbor::CBORValue::MapValue userEntityMap; 356 358 userEntityMap[cbor::CBORValue(fido::kEntityIdMapKey)] = cbor::CBORValue(creationOptions.user.id); 357 359 userEntityMap[cbor::CBORValue(fido::kEntityNameMapKey)] = cbor::CBORValue(creationOptions.user.name); 360 userEntityMap[cbor::CBORValue(fido::kDisplayNameMapKey)] = cbor::CBORValue(creationOptions.user.displayName); 358 361 auto userEntity = cbor::CBORWriter::write(cbor::CBORValue(WTFMove(userEntityMap))); 359 362 ASSERT(userEntity); -
trunk/Tools/ChangeLog
r286709 r286746 1 2021-12-08 J Pascoe <j_pascoe@apple.com> 2 3 [WebAuthn] Consider support for the displayName for FIDO authenticator 4 https://bugs.webkit.org/show_bug.cgi?id=233389 5 rdar://84938707 6 7 Reviewed by Brent Fulgham. 8 9 Add test for new field stored with platform authenticator: displayName 10 11 * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: 12 (TestWebKitAPI::TEST): 13 1 14 2021-12-08 Truitt Savell <tsavell@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm
r286078 r286746 2194 2194 } 2195 2195 2196 TEST(WebAuthenticationPanel, GetAllCredentialWithDisplayName) 2197 { 2198 reset(); 2199 2200 // {"id": h'00010203040506070809', "name": "John", "displayName": "Johnny"} 2201 ASSERT_TRUE(addKeyToKeychain(testES256PrivateKeyBase64, "example.com", "o2JpZEoAAQIDBAUGBwgJZG5hbWVkSm9obmtkaXNwbGF5TmFtZWZKb2hubnk=")); 2202 2203 auto after = adoptNS([[NSDate alloc] init]); 2204 2205 auto *credentials = [_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentialsWithAccessGroup:@"com.apple.TestWebKitAPI"]; 2206 EXPECT_NOT_NULL(credentials); 2207 EXPECT_EQ([credentials count], 1lu); 2208 2209 EXPECT_NOT_NULL([credentials firstObject]); 2210 EXPECT_WK_STREQ([credentials firstObject][_WKLocalAuthenticatorCredentialNameKey], "John"); 2211 EXPECT_WK_STREQ([credentials firstObject][_WKLocalAuthenticatorCredentialDisplayNameKey], "Johnny"); 2212 2213 cleanUpKeychain("example.com"); 2214 } 2215 2196 2216 TEST(WebAuthenticationPanel, UpdateCredentialUsername) 2197 2217 {
Note:
See TracChangeset
for help on using the changeset viewer.