Commit 76b68f82 authored by Jun Choi's avatar Jun Choi Committed by Commit Bot

Add UI sheets for USB security key use flow

Add "Verifying USB" sheet to USB UI flow and combine 'kInsertUsb' state
and 'kActivateUsb' state as it is shown in a single UI flow. As we do
not plan on implementing "Complete" UI sheet for initial version, this
completes the UI flow for USB security key use.

Bug: 849323
Change-Id: I8c1a8cbc8d4aedee557ac65c730b99295070a4ab
Reviewed-on: https://chromium-review.googlesource.com/1105403
Commit-Queue: Jun Choi <hongjunchoi@chromium.org>
Reviewed-by: default avatarKim Paulhamus <kpaulhamus@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572071}
parent cf25f142
......@@ -10002,9 +10002,12 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_WEBAUTHN_TRANSPORT_CABLE" desc="Use a phone as a Security Key over cloud-assisted BLE with the Web Authentication API.">
Use your phone as a Security Key
</message>
<message name="IDS_WEBAUTHN_USB_TITLE" desc="Title of the dialog shown when the user has choosen to access their security key through USB.">
<message name="IDS_WEBAUTHN_USB_TITLE_ON_REGISTER" desc="Title of the dialog shown when the user has choosen to access their security key through USB during registration.">
Use USB Security Key
</message>
<message name="IDS_WEBAUTHN_USB_TITLE_ON_SIGNIN" desc="Title of the dialog shown when the user has choosen to access their security key through USB during sign-in.">
Use USB Security Key with <ph name="APP_NAME">$1<ex>google.com</ex></ph>
</message>
<message name="IDS_WEBAUTHN_USB_INSERT_DESCRIPTION" desc="Contents of the dialog shown instructing the user to plug in their USB security key.">
Plug in your Security Key and activate it
</message>
......
......@@ -42,14 +42,19 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
std::make_unique<AuthenticatorTransportSelectorSheetModel>(
dialog_model));
break;
case Step::kUsbInsert:
case Step::kUsbInsertAndActivateOnRegister:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorInsertUsbSheetModel>(dialog_model));
std::make_unique<
AuthenticatorInsertAndActivateUsbOnRegisterSheetModel>(
dialog_model));
break;
case Step::kUsbInsertAndActivateOnSign:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorInsertAndActivateUsbOnSignSheetModel>(
dialog_model));
break;
case Step::kErrorTimedOut:
case Step::kCompleted:
case Step::kUsbActivate:
case Step::kUsbVerifying:
case Step::kBlePowerOnAutomatic:
case Step::kBlePowerOnManual:
case Step::kBlePairingBegin:
......
......@@ -34,6 +34,12 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
AuthenticatorTransport::kCloudAssistedBluetoothLowEnergy);
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kTransportSelection);
} else if (name == "insert_usb_register") {
model->SetCurrentStep(AuthenticatorRequestDialogModel::Step::
kUsbInsertAndActivateOnRegister);
} else if (name == "insert_usb_sign") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kUsbInsertAndActivateOnSign);
}
ShowAuthenticatorRequestDialog(
......@@ -58,3 +64,10 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_completed) {
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_transports) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_register) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_sign) {
ShowAndVerifyUi();
}
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webauthn/sheet_models.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -95,13 +96,31 @@ void AuthenticatorTransportSelectorSheetModel::OnTransportSelected(
dialog_model()->StartGuidedFlowForTransport(transport);
}
// AuthenticatorInsertUsbSheetModel
// ---------------------------------------------
// AuthenticatorInsertAndActivateUsbOnRegisterSheetModel ----------------------
base::string16 AuthenticatorInsertUsbSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_USB_TITLE);
base::string16
AuthenticatorInsertAndActivateUsbOnRegisterSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_USB_TITLE_ON_REGISTER);
}
base::string16 AuthenticatorInsertUsbSheetModel::GetStepDescription() const {
base::string16
AuthenticatorInsertAndActivateUsbOnRegisterSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_USB_INSERT_DESCRIPTION);
}
// AuthenticatorInsertAndActivateUsbOnSignSheetModel ----------------------
base::string16 AuthenticatorInsertAndActivateUsbOnSignSheetModel::GetStepTitle()
const {
// TODO(hongjunchoi): Insert actual domain name from model to
// |application_name|.
base::string16 application_name = base::UTF8ToUTF16("example.com");
return l10n_util::GetStringFUTF16(IDS_WEBAUTHN_USB_TITLE_ON_SIGNIN,
application_name);
}
base::string16
AuthenticatorInsertAndActivateUsbOnSignSheetModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_USB_INSERT_DESCRIPTION);
}
......@@ -73,7 +73,19 @@ class AuthenticatorTransportSelectorSheetModel
base::string16 GetStepDescription() const override;
};
class AuthenticatorInsertUsbSheetModel : public AuthenticatorSheetModelBase {
class AuthenticatorInsertAndActivateUsbOnRegisterSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
class AuthenticatorInsertAndActivateUsbOnSignSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
......
......@@ -21,7 +21,7 @@ void AuthenticatorRequestDialogModel::StartGuidedFlowForTransport(
DCHECK_EQ(current_step(), Step::kTransportSelection);
switch (transport) {
case AuthenticatorTransport::kUsb:
SetCurrentStep(Step::kUsbInsert);
SetCurrentStep(Step::kUsbInsertAndActivateOnRegister);
break;
default:
break;
......@@ -51,7 +51,7 @@ void AuthenticatorRequestDialogModel::FinishPairingWithPin(
}
void AuthenticatorRequestDialogModel::TryUsbDevice() {
DCHECK_EQ(current_step(), Step::kUsbInsert);
DCHECK_EQ(current_step(), Step::kUsbInsertAndActivateOnRegister);
}
void AuthenticatorRequestDialogModel::Cancel() {}
......
......@@ -25,9 +25,8 @@ class AuthenticatorRequestDialogModel {
kCompleted,
// Universal Serial Bus (USB).
kUsbInsert,
kUsbActivate,
kUsbVerifying,
kUsbInsertAndActivateOnRegister,
kUsbInsertAndActivateOnSign,
// Bluetooth Low Energy (BLE).
kBlePowerOnAutomatic,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment