Changeset 258442 in webkit


Ignore:
Timestamp:
Mar 13, 2020 4:15:31 PM (4 years ago)
Author:
jiewen_tan@apple.com
Message:

[WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
https://bugs.webkit.org/show_bug.cgi?id=208703
<rdar://problem/60136974>

Reviewed by Darin Adler.

Source/WebCore:

  • en.lproj/Localizable.strings:
  • platform/LocalizedStrings.cpp:

(WebCore::touchIDPromptTitle):

  • platform/LocalizedStrings.h:

Adds a new formatted UI string to help with RP ID.

Source/WebKit:

On macOS, LocalAuthentication prompt can be shown anywhere that is probably not on top of
our UI clients. Therefore, add a RP ID to the dialog to help users to identify what has
happened. In addition, it removes the password fallback button.

  • Platform/spi/Cocoa/LocalAuthenticationSPI.h:
  • UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:

(WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
(WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):

  • UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
  • UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:

(WebKit::LocalConnection::verifyUser const):

  • UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
  • UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:

(WebKit::MockLocalConnection::verifyUser const):

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r258434 r258442  
     12020-03-13  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 Darin Adler.
     8
     9        * en.lproj/Localizable.strings:
     10        * platform/LocalizedStrings.cpp:
     11        (WebCore::touchIDPromptTitle):
     12        * platform/LocalizedStrings.h:
     13        Adds a new formatted UI string to help with RP ID.
     14
    1152020-03-13  Peng Liu  <peng.liu6@apple.com>
    216
  • trunk/Source/WebCore/en.lproj/Localizable.strings

    r258092 r258442  
    887887"Touch ID to sign into this website." = "Touch ID to sign into this website.";
    888888
     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.";
     891
    889892/* Transformations context sub-menu item */
    890893"Transformations" = "Transformations";
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r257877 r258442  
    12091209
    12101210#if ENABLE(WEB_AUTHN)
    1211 String touchIDPromptTitle()
     1211String genericTouchIDPromptTitle()
    12121212{
    12131213    return WEB_UI_STRING("Touch ID to sign into this website.", "Use Touch ID to sign into this website");
    12141214}
    12151215
     1216String 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
    12161221String biometricFallbackPromptTitle()
    12171222{
  • trunk/Source/WebCore/platform/LocalizedStrings.h

    r257877 r258442  
    341341
    342342#if ENABLE(WEB_AUTHN)
    343     WEBCORE_EXPORT String touchIDPromptTitle();
     343    WEBCORE_EXPORT String genericTouchIDPromptTitle();
     344    WEBCORE_EXPORT String makeCredentialTouchIDPromptTitle(const String& domain);
    344345    WEBCORE_EXPORT String biometricFallbackPromptTitle();
    345346#endif
  • trunk/Source/WebKit/ChangeLog

    r258441 r258442  
     12020-03-13  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 Darin Adler.
     8
     9        On macOS, LocalAuthentication prompt can be shown anywhere that is probably not on top of
     10        our UI clients. Therefore, add a RP ID to the dialog to help users to identify what has
     11        happened. In addition, it removes the password fallback button.
     12
     13        * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
     14        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
     15        (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
     16        (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
     17        * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
     18        * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
     19        (WebKit::LocalConnection::verifyUser const):
     20        * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
     21        * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
     22        (WebKit::MockLocalConnection::verifyUser const):
     23
    1242020-03-13  Brent Fulgham  <bfulgham@apple.com>
    225
  • trunk/Source/WebKit/Platform/spi/Cocoa/LocalAuthenticationSPI.h

    r257877 r258442  
    3737    LAOptionAuthenticationTitle,
    3838    LAOptionPasscodeTitle,
     39    LAOptionFallbackVisible,
    3940};
    4041
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm

    r258293 r258442  
    238238    m_state = State::PolicyDecided;
    239239
     240    auto& creationOptions = WTF::get<PublicKeyCredentialCreationOptions>(requestData().options);
     241
    240242    if (policy == LocalAuthenticatorPolicy::Disallow) {
    241243        receiveRespond(ExceptionData { UnknownError, "Disallow local authenticator."_s });
     
    262264        weakThis->continueMakeCredentialAfterUserVerification(accessControl.get(), verification, context);
    263265    };
    264     m_connection->verifyUser(accessControlRef, WTFMove(callback));
     266    m_connection->verifyUser(creationOptions.rp.id, accessControlRef, WTFMove(callback));
    265267}
    266268
     
    477479    m_state = State::ResponseSelected;
    478480
     481    auto& requestOptions = WTF::get<PublicKeyCredentialRequestOptions>(requestData().options);
     482
    479483    auto accessControlRef = response->accessControl();
    480484    auto callback = [
     
    488492        weakThis->continueGetAssertionAfterUserVerification(WTFMove(response), verification, context);
    489493    };
    490     m_connection->verifyUser(accessControlRef, WTFMove(callback));
     494    m_connection->verifyUser(requestOptions.rpId, accessControlRef, WTFMove(callback));
    491495}
    492496
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.h

    r257877 r258442  
    6363
    6464    // Overrided by MockLocalConnection.
    65     virtual void verifyUser(SecAccessControlRef, UserVerificationCallback&&) const;
     65    virtual void verifyUser(const String& rpId, SecAccessControlRef, UserVerificationCallback&&) const;
    6666    virtual RetainPtr<SecKeyRef> createCredentialPrivateKey(LAContext *, SecAccessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const;
    6767    virtual void getAttestation(SecKeyRef, NSData *authData, NSData *hash, AttestationCallback&&) const;
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm

    r257891 r258442  
    4141namespace WebKit {
    4242
    43 void LocalConnection::verifyUser(SecAccessControlRef accessControl, UserVerificationCallback&& completionHandler) const
     43void LocalConnection::verifyUser(const String& rpId, SecAccessControlRef accessControl, UserVerificationCallback&& completionHandler) const
    4444{
    4545    auto context = adoptNS([allocLAContextInstance() init]);
    4646
    4747    auto options = adoptNS([[NSMutableDictionary alloc] init]);
    48     if ([context biometryType] == LABiometryTypeTouchID)
    49         [options setObject:WebCore::touchIDPromptTitle() forKey:@(LAOptionAuthenticationTitle)];
    50 #if PLATFORM(iOS)
     48    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
     55        [options setObject:@NO forKey:@(LAOptionFallbackVisible)];
     56    }
     57#if PLATFORM(IOS)
    5158    [options setObject:WebCore::biometricFallbackPromptTitle() forKey:@(LAOptionPasscodeTitle)];
    5259#endif
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h

    r257877 r258442  
    3838
    3939private:
    40     void verifyUser(SecAccessControlRef, UserVerificationCallback&&) const final;
     40    void verifyUser(const String&, SecAccessControlRef, UserVerificationCallback&&) const final;
    4141    RetainPtr<SecKeyRef> createCredentialPrivateKey(LAContext *, SecAccessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const final;
    4242    void getAttestation(SecKeyRef, NSData *authData, NSData *hash, AttestationCallback&&) const final;
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm

    r258293 r258442  
    4545}
    4646
    47 void MockLocalConnection::verifyUser(SecAccessControlRef, UserVerificationCallback&& callback) const
     47void MockLocalConnection::verifyUser(const String&, SecAccessControlRef, UserVerificationCallback&& callback) const
    4848{
    4949    // Mock async operations.
Note: See TracChangeset for help on using the changeset viewer.