Changeset 258961 in webkit
- Timestamp:
- Mar 24, 2020 5:03:19 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r258959 r258961 1 2020-03-24 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt 4 https://bugs.webkit.org/show_bug.cgi?id=208703 5 <rdar://problem/60136974> 6 7 Reviewed by Brent Fulgham. 8 9 Part 2. 10 11 This patch adds a different LocalAuthentication prompt title for getAssertion. 12 It also polishes the text used for makeCredential. 13 14 Besides that, it also enhances the iOS title strings. 15 16 * en.lproj/Localizable.strings: 17 * platform/LocalizedStrings.cpp: 18 (WebCore::getAssertionTouchIDPromptTitle): 19 * platform/LocalizedStrings.h: 20 1 21 2020-03-24 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/Source/WebCore/en.lproj/Localizable.strings
r258442 r258961 1 /* Allow the specified bundle to use Touch ID to sign in to the specified website on this device */ 2 "“%@” would like to use Touch ID for “%@”." = "“%@” would like to use Touch ID for “%@”."; 3 4 /* "Allow the specified bundle to sign in to the specified website */ 5 "“%@” would like to sign in to “%@”." = "“%@” would like to sign in to “%@”."; 6 1 7 /* accessibility help text for media controller time value >= 1 day */ 2 8 "%1$d days %2$d hours %3$d minutes %4$d seconds" = "%1$d days %2$d hours %3$d minutes %4$d seconds"; … … 314 320 "Enter Full Screen" = "Enter Full Screen"; 315 321 316 /* Use passcode as a fallback to sign into this website */317 "Enter passcode to sign into this website." = "Enter passcode to sign into this website.";318 319 322 /* menu item */ 320 323 "Enter Picture in Picture" = "Enter Picture in Picture"; … … 866 869 "This website may try to trick you into installing software that harms your browsing experience, like changing your settings without your permission or showing you unwanted ads. Once installed, it may be difficult to remove." = "This website may try to trick you into installing software that harms your browsing experience, like changing your settings without your permission or showing you unwanted ads. Once installed, it may be difficult to remove."; 867 870 871 /* This website would like to use Touch ID */ 872 "This website would like to use Touch ID." = "This website would like to use Touch ID."; 873 868 874 /* Informative text for requesting cross-site cookie and website data access. */ 869 875 "This will allow “%@” to track your activity." = "This will allow “%@” to track your activity."; … … 884 890 "To view this page, you must log in to this area on %@:" = "To view this page, you must log in to this area on %@:"; 885 891 886 /* Use Touch ID to sign into this website */ 887 "Touch ID to sign into this website." = "Touch ID to sign into this website."; 888 889 /* Allow using Touch ID to sign into the specified website on this device */ 890 "Touch ID to allow signing into “%@” with Touch ID." = "Touch ID to allow signing into “%@” with Touch ID."; 892 /* Use Touch ID to sign in to this website */ 893 "Touch ID to sign in to this website." = "Touch ID to sign in to this website."; 891 894 892 895 /* Transformations context sub-menu item */ -
trunk/Source/WebCore/platform/LocalizedStrings.cpp
r258442 r258961 1209 1209 1210 1210 #if ENABLE(WEB_AUTHN) 1211 String genericTouchIDPromptTitle() 1212 { 1213 return WEB_UI_STRING("Touch ID to sign into this website.", "Use Touch ID to sign into this website"); 1214 } 1215 1216 String makeCredentialTouchIDPromptTitle(const String& domain) 1217 { 1218 return formatLocalizedString(WEB_UI_CFSTRING("Touch ID to allow signing into “%@” with Touch ID.", "Allow using Touch ID to sign into the specified website on this device"), domain.createCFString().get()); 1219 } 1220 1221 String biometricFallbackPromptTitle() 1222 { 1223 return WEB_UI_STRING("Enter passcode to sign into this website.", "Use passcode as a fallback to sign into this website"); 1224 } 1225 #endif 1211 // On macOS, Touch ID prompt is not guaranteed to show on top of the UI client, and therefore additional 1212 // information is provided to help users to make decisions. 1213 #if PLATFORM(MAC) 1214 String makeCredentialTouchIDPromptTitle(const String& bundleName, const String& domain) 1215 { 1216 return formatLocalizedString(WEB_UI_CFSTRING("“%@” would like to use Touch ID for “%@”.", "Allow the specified bundle to use Touch ID to sign in to the specified website on this device"), bundleName.createCFString().get(), domain.createCFString().get()); 1217 } 1218 1219 String getAssertionTouchIDPromptTitle(const String& bundleName, const String& domain) 1220 { 1221 return formatLocalizedString(WEB_UI_CFSTRING("“%@” would like to sign in to “%@”.", "Allow the specified bundle to sign in to the specified website"), bundleName.createCFString().get(), domain.createCFString().get()); 1222 } 1223 #else 1224 String makeCredentialTouchIDPromptTitle(const String&, const String&) 1225 { 1226 return WEB_UI_STRING("This website would like to use Touch ID.", "This website would like to use Touch ID"); 1227 } 1228 1229 String getAssertionTouchIDPromptTitle(const String&, const String&) 1230 { 1231 return WEB_UI_STRING("Touch ID to sign in to this website.", "Use Touch ID to sign in to this website"); 1232 } 1233 #endif // PLATFORM(MAC) 1234 #endif // ENABLE(WEB_AUTHN) 1226 1235 1227 1236 } // namespace WebCore -
trunk/Source/WebCore/platform/LocalizedStrings.h
r258442 r258961 341 341 342 342 #if ENABLE(WEB_AUTHN) 343 WEBCORE_EXPORT String genericTouchIDPromptTitle(); 344 WEBCORE_EXPORT String makeCredentialTouchIDPromptTitle(const String& domain); 345 WEBCORE_EXPORT String biometricFallbackPromptTitle(); 343 WEBCORE_EXPORT String makeCredentialTouchIDPromptTitle(const String& bundleName, const String& domain); 344 WEBCORE_EXPORT String getAssertionTouchIDPromptTitle(const String& bundleName, const String& domain); 346 345 #endif 347 346 -
trunk/Source/WebKit/ChangeLog
r258958 r258961 1 2020-03-24 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt 4 https://bugs.webkit.org/show_bug.cgi?id=208703 5 <rdar://problem/60136974> 6 7 Reviewed by Brent Fulgham. 8 9 Part 2. 10 11 This patch adds a different LocalAuthentication prompt title for getAssertion. 12 It also polishes the text used for makeCredential. 13 14 Besides that, it also enhances the iOS title strings. 15 16 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 17 (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy): 18 (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): 19 * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: 20 * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: 21 (WebKit::LocalConnection::verifyUser const): 22 * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: 23 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: 24 (WebKit::MockLocalConnection::verifyUser const): 25 1 26 2020-03-24 Kate Cheney <katherine_cheney@apple.com> 2 27 -
trunk/Source/WebKit/Sources.txt
r258734 r258961 470 470 UIProcess/WebAuthentication/Authenticator.cpp 471 471 UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 472 UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp 472 473 473 474 UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
r257954 r258961 144 144 } 145 145 146 static ClientDataType getClientDataType(const Variant<PublicKeyCredentialCreationOptions, PublicKeyCredentialRequestOptions>& options)147 {148 if (WTF::holds_alternative<PublicKeyCredentialCreationOptions>(options))149 return ClientDataType::Create;150 return ClientDataType::Get;151 }152 153 146 } // namespace 154 147 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r258602 r258961 264 264 weakThis->continueMakeCredentialAfterUserVerification(accessControl.get(), verification, context); 265 265 }; 266 m_connection->verifyUser(creationOptions.rp.id, accessControlRef, WTFMove(callback));266 m_connection->verifyUser(creationOptions.rp.id, getClientDataType(requestData().options), accessControlRef, WTFMove(callback)); 267 267 } 268 268 … … 492 492 weakThis->continueGetAssertionAfterUserVerification(WTFMove(response), verification, context); 493 493 }; 494 m_connection->verifyUser(requestOptions.rpId, accessControlRef, WTFMove(callback));494 m_connection->verifyUser(requestOptions.rpId, getClientDataType(requestData().options), accessControlRef, WTFMove(callback)); 495 495 } 496 496 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.h
r258442 r258961 38 38 namespace WebCore { 39 39 class AuthenticatorAssertionResponse; 40 enum class ClientDataType : bool; 40 41 } 41 42 … … 60 61 61 62 LocalConnection() = default; 63 // FIXME(183534): Invalidate the LAContext. 62 64 virtual ~LocalConnection() = default; 63 65 64 66 // Overrided by MockLocalConnection. 65 virtual void verifyUser(const String& rpId, SecAccessControlRef, UserVerificationCallback&&) const;67 virtual void verifyUser(const String& rpId, WebCore::ClientDataType, SecAccessControlRef, UserVerificationCallback&&) const; 66 68 virtual RetainPtr<SecKeyRef> createCredentialPrivateKey(LAContext *, SecAccessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const; 67 69 virtual void getAttestation(SecKeyRef, NSData *authData, NSData *hash, AttestationCallback&&) const; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm
r258442 r258961 40 40 41 41 namespace WebKit { 42 using namespace WebCore; 42 43 43 void LocalConnection::verifyUser(const String& rpId, SecAccessControlRef accessControl, UserVerificationCallback&& completionHandler) const 44 namespace { 45 static String bundleName() 44 46 { 47 String bundleName; 48 49 #if PLATFORM(MAC) 50 bundleName = [[NSRunningApplication currentApplication] localizedName]; 51 #endif 52 53 return bundleName; 54 } 55 } // namespace 56 57 void LocalConnection::verifyUser(const String& rpId, ClientDataType type, SecAccessControlRef accessControl, UserVerificationCallback&& completionHandler) const 58 { 59 String title; 60 switch (type) { 61 case ClientDataType::Create: 62 title = makeCredentialTouchIDPromptTitle(bundleName(), rpId); 63 break; 64 case ClientDataType::Get: 65 title = getAssertionTouchIDPromptTitle(bundleName(), rpId); 66 break; 67 default: 68 ASSERT_NOT_REACHED(); 69 } 70 45 71 auto context = adoptNS([allocLAContextInstance() init]); 46 72 47 73 auto options = adoptNS([[NSMutableDictionary alloc] init]); 48 74 if ([context biometryType] == LABiometryTypeTouchID) { 49 #if PLATFORM(IOS) 50 [options setObject:WebCore::genericTouchIDPromptTitle() forKey:@(LAOptionAuthenticationTitle)]; 51 ASSERT_UNUSED(rpId, rpId); 52 #else 53 [options setObject:WebCore::makeCredentialTouchIDPromptTitle(rpId) forKey:@(LAOptionAuthenticationTitle)]; 54 #endif 75 [options setObject:title forKey:@(LAOptionAuthenticationTitle)]; 55 76 [options setObject:@NO forKey:@(LAOptionFallbackVisible)]; 56 77 } 57 #if PLATFORM(IOS)58 [options setObject:WebCore::biometricFallbackPromptTitle() forKey:@(LAOptionPasscodeTitle)];59 #endif60 78 61 79 auto reply = makeBlockPtr([context, completionHandler = WTFMove(completionHandler)] (NSDictionary *, NSError *error) mutable { -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h
r258442 r258961 38 38 39 39 private: 40 void verifyUser(const String&, SecAccessControlRef, UserVerificationCallback&&) const final;40 void verifyUser(const String&, WebCore::ClientDataType, SecAccessControlRef, UserVerificationCallback&&) const final; 41 41 RetainPtr<SecKeyRef> createCredentialPrivateKey(LAContext *, SecAccessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const final; 42 42 void getAttestation(SecKeyRef, NSData *authData, NSData *hash, AttestationCallback&&) const final; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
r258442 r258961 45 45 } 46 46 47 void MockLocalConnection::verifyUser(const String&, SecAccessControlRef, UserVerificationCallback&& callback) const47 void MockLocalConnection::verifyUser(const String&, WebCore::ClientDataType, SecAccessControlRef, UserVerificationCallback&& callback) const 48 48 { 49 49 // Mock async operations. -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp
r258960 r258961 1 1 /* 2 * Copyright (C) 20 18Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "WebAuthenticationRequestData.h" 27 28 28 29 #if ENABLE(WEB_AUTHN) 29 30 30 #include "LocalConnection.h" 31 #include <WebCore/MockWebAuthenticationConfiguration.h> 31 namespace WebKit { 32 using namespace WebCore; 32 33 33 namespace WebKit { 34 35 class MockLocalConnection final : public LocalConnection { 36 public: 37 explicit MockLocalConnection(const WebCore::MockWebAuthenticationConfiguration&); 38 39 private: 40 void verifyUser(const String&, SecAccessControlRef, UserVerificationCallback&&) const final; 41 RetainPtr<SecKeyRef> createCredentialPrivateKey(LAContext *, SecAccessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const final; 42 void getAttestation(SecKeyRef, NSData *authData, NSData *hash, AttestationCallback&&) const final; 43 void filterResponses(HashSet<Ref<WebCore::AuthenticatorAssertionResponse>>&) const final; 44 45 WebCore::MockWebAuthenticationConfiguration m_configuration; 46 }; 34 ClientDataType getClientDataType(const Variant<PublicKeyCredentialCreationOptions, PublicKeyCredentialRequestOptions>& options) 35 { 36 if (WTF::holds_alternative<PublicKeyCredentialCreationOptions>(options)) 37 return ClientDataType::Create; 38 return ClientDataType::Get; 39 } 47 40 48 41 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h
r257571 r258961 34 34 #include <WebCore/PublicKeyCredentialCreationOptions.h> 35 35 #include <WebCore/PublicKeyCredentialRequestOptions.h> 36 #include <WebCore/WebAuthenticationConstants.h> 36 37 #include <wtf/Variant.h> 37 38 #include <wtf/Vector.h> … … 52 53 }; 53 54 55 WebCore::ClientDataType getClientDataType(const Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions>&); 56 54 57 } // namespace WebKit 55 58
Note: See TracChangeset
for help on using the changeset viewer.