1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
ash / public / cpp / webauthn_dialog_controller.h [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_WEBAUTHN_DIALOG_CONTROLLER_H_
#define ASH_PUBLIC_CPP_WEBAUTHN_DIALOG_CONTROLLER_H_
#include "ash/public/cpp/ash_public_export.h"
#include "ash/public/cpp/in_session_auth_dialog_client.h"
namespace aura {
class Window;
}
namespace ash {
// WebAuthNDialogController manages the webauthn auth dialog.
class ASH_PUBLIC_EXPORT WebAuthNDialogController {
public:
// Callback for authentication checks. |success| true/false if auth
// succeeded/failed, and |can_use_pin| indicates whether PIN can still be used
// (not locked out) after the previous authentication.
using OnAuthenticateCallback =
base::OnceCallback<void(bool success, bool can_use_pin)>;
// Callback for overall authentication flow result.
using FinishCallback = base::OnceCallback<void(bool success)>;
// Return the singleton instance.
static WebAuthNDialogController* Get();
// Sets the client that will handle authentication.
virtual void SetClient(InSessionAuthDialogClient* client) = 0;
// Displays the authentication dialog for the website/app name in |app_id|.
virtual void ShowAuthenticationDialog(aura::Window* source_window,
const std::string& origin_name,
FinishCallback finish_callback) = 0;
// Destroys the authentication dialog.
virtual void DestroyAuthenticationDialog() = 0;
// Takes a password or PIN and sends it to InSessionAuthDialogClient to
// authenticate. The InSessionAuthDialogClient should already know the current
// session's active user, so the user account is not provided here.
virtual void AuthenticateUserWithPasswordOrPin(
const std::string& password,
bool authenticated_by_pin,
OnAuthenticateCallback callback) = 0;
// Requests ChromeOS to report fingerprint scan result through |callback|.
virtual void AuthenticateUserWithFingerprint(
base::OnceCallback<void(bool, FingerprintState)> callback) = 0;
// Opens a help article in Chrome.
virtual void OpenInSessionAuthHelpPage() = 0;
// Cancels all operations and destroys the dialog.
virtual void Cancel() = 0;
// Checks whether there's at least one authentication method.
virtual void CheckAvailability(
FinishCallback on_availability_checked) const = 0;
protected:
WebAuthNDialogController();
virtual ~WebAuthNDialogController();
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_WEBAUTHN_DIALOG_CONTROLLER_H_