summaryrefslogtreecommitdiff
path: root/chromium/components/arc/common/auth.mojom
blob: b82692f65fa6912a8ec63019cf59a7918dc20d8b (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next MinVersion: 10

module arc.mojom;

// These values describe failure reason of sign-in.
[Extensible]
enum ArcSignInFailureReason {
  // Negative values are reserved for internal use.
  // The values are shuffled to keep the backward compatibility and don't match
  // ProvisioningResult in arc_optin_uma.h
  // Next value: 16.
  UNKNOWN_ERROR = 0,

  // Mojo errors:
  // MOJO_VERSION_MISMATCH: is sent when an API is not supported
  //   due to Host/Instance version mismatch.
  // MOJO_CALL_TIMEOUT: is sent when a Mojo invocation is started
  //   but not completed with time out.
  MOJO_VERSION_MISMATCH = 6,
  MOJO_CALL_TIMEOUT = 7,

  // Device check-in errors:
  // DEVICE_CHECK_IN_FAILED: is sent when "check-in" procedure is completed
  //   but is actually failed.
  // DEVICE_CHECK_IN_TIMEOUT: is sent when "check-in" procedure started
  //   but is not completed.
  // DEVICE_CHECK_IN_INTERNAL_ERROR: is sent when "check-in" procedure is
  //   started, but some unexpected error situation happens so that it could
  //   not completed.
  DEVICE_CHECK_IN_FAILED = 4,
  DEVICE_CHECK_IN_TIMEOUT = 8,
  DEVICE_CHECK_IN_INTERNAL_ERROR = 9,

  // GMS errors:
  // GMS_NETWORK_ERROR: is sent when GMS sign-in procedure is started, but
  //   it reports NETWORK_ERROR.
  // GMS_SERVICE_UNAVAILABLE: is sent when GMS sign-in procedure is started
  //   but it reports SERVICE_UNAVAILABLE. Note that this is not generic
  //   service unavailable error code.
  // GMS_BAD_AUTHENTICATION: is sent when GMS sign-in procedure is started
  //   but it reports BAD_AUTHENTICATION.
  // GMS_SIGN_IN_FAILED: is sent when GMS sign in procedure is started but
  //   it reports an error other than above NETWORK_ERROR, SERVICE_UNAVAILABLE
  //   or BAD_AUTHENTICATION. In general, we do not expect this kind of cases.
  // GMS_SIGN_IN_TIMEOUT: is sent when GMS sign in procedure is started but
  //   not returned.
  // GMS_SIGN_IN_INTERNAL_ERROR: is sent when GMS sign in procedure is started
  //   but could not completed.
  GMS_NETWORK_ERROR = 1,
  GMS_SERVICE_UNAVAILABLE = 2,
  GMS_BAD_AUTHENTICATION = 3,
  GMS_SIGN_IN_FAILED = 10,
  GMS_SIGN_IN_TIMEOUT = 11,
  GMS_SIGN_IN_INTERNAL_ERROR = 12,

  // Cloud provisioning errors.
  CLOUD_PROVISION_FLOW_FAILED = 5,
  CLOUD_PROVISION_FLOW_TIMEOUT = 13,
  CLOUD_PROVISION_FLOW_INTERNAL_ERROR = 14,

  // Network connection is unavailable.
  [MinVersion=8] NO_NETWORK_CONNECTION = 15,
};

// These values describe account check status.
[Extensible]
enum AccountCheckStatus {
    // Checked account exists and is up to date.
    [MinVersion=9] UP_TO_DATE = 0,

    // Checked account is new in the system.
    [MinVersion=9] NEW = 1,

    // Checked account exists but need to be reauthorized.
    [MinVersion=9] NEED_REAUTH = 2,

    // Checked account exists but it is in unknown state.
    [MinVersion=9] UNKNOWN = 3,

    // Account check has failed.
    [MinVersion=9] CHECK_FAILED = 4,

    // NOTE: If you add any entries to this enum, you must also update the
    // corresponding UMA callsite in Chrome arc::UpdateAuthAccountCheckStatus.
};

// These values describe the type of the Chrome account to provision.
[Extensible]
enum ChromeAccountType {
  // Next value: 4
  UNKNOWN = 0,

  // Chrome login account type is a user account.
  USER_ACCOUNT = 1,

  // Chrome login account type is a robot (service) account.
  ROBOT_ACCOUNT = 2,

  // Chrome login account type is an Active Directory account.
  ACTIVE_DIRECTORY_ACCOUNT = 3,
};

// These values describe the type of the metrics to report.
[Extensible]
enum MetricsType {
  // Duration of waiting for network connection in milliseconds.
  NETWORK_WAITING_TIME_MILLISECONDS = 0,

  // Number of attempts to wait for Checkin task completed. 0 indicates that
  // Checkin task was already completed prior to GMS SignIn.
  CHECKIN_ATTEMPTS = 1,

  // Duration of waiting for Checkin task completed in milliseconds.
  CHECKIN_TIME_MILLISECONDS = 2,

  // Duration of waiting for sign-in completed in milliseconds.
  SIGNIN_TIME_MILLISECONDS = 3,

  // Duration of checking the status of account.
  [MinVersion=9] ACCOUNT_CHECK_MILLISECONDS = 4,
};

// The necessary information for Android to sign in and provision itself.
struct AccountInfo {
  // Name of account, used to map to existing Android account.
  [MinVersion=9] string? account_name@4;

  // The authorization code that can be used in Android to sign in when
  // account_type is USER_ACCOUNT or ROBOT_ACCOUNT. If it is null in these
  // cases, sign-in will be skipped.
  string? auth_code@0;

  // If account_type is ACTIVE_DIRECTORY_ACCOUNT, this contains an enrollment
  // token for a Managed Google Play account. If it is null in this case,
  // sign-in will be skipped.
  [MinVersion=6] string? enrollment_token@3;

  // The type of Chrome account to provision.
  ChromeAccountType account_type@1;

  // Whether the account is managed from Chrome OS.
  bool is_managed@2;
};

// Next Method ID: 10.
interface AuthHost {
  // Notifies Chrome that the sign-in is completed successfully.
  [MinVersion=2] OnSignInComplete@2();
  // Notifies Chrome that the sign-in fails to complete and provides failure
  // reason.
  [MinVersion=2] OnSignInFailed@3(ArcSignInFailureReason reason);
  // Asynchronously requests an authorization code, as well as the account
  // information.
  [MinVersion=5] RequestAccountInfo@7();

  // Reports metrics to Chrome to be recorded in UMA.
  [MinVersion=7] ReportMetrics@8(MetricsType metrics_type, int32 value);

  // Reports result of account check.
  [MinVersion=9] ReportAccountCheckStatus@9(AccountCheckStatus status);

  // Deprecated methods:

  // Returns an authorization code, which can be used to sign in.
  GetAuthCodeDeprecated0@0() => (string auth_code);
  // Returns an authorization code in case is_enforced is set, which can be
  // used to sign in. By default the ChromeAccountType is USER_ACCOUNT.
  [MinVersion=1] GetAuthCodeDeprecated@1() => (string auth_code,
                                               bool is_enforced);
  // Returns an authorization code and its ChromeAccountType in case
  // is_enforced is set, which can be used to sign in.
  [MinVersion=4] GetAuthCodeAndAccountTypeDeprecated@5() => (
          string auth_code, bool is_enforced, ChromeAccountType account_type);
  // Gets whether the account is managed from Chrome OS.
  [MinVersion=3] GetIsAccountManagedDeprecated@4() => (bool is_managed);
};

// Next Method ID: 2
interface AuthInstance {
  // Establishes full-duplex communication with the host.
  Init@0(AuthHost host_ptr);

  // Callback from RequestAccountInfo. This cannot be a normal callback since
  // the result can sometimes take a few minutes in some cases (Kiosk mode),
  // and in other cases there is a UI that the user is shown and they can take
  // an arbitrarily long amount of time to interact with.
  // If |account_info| is null, it implies that there was an error in the
  // process.
  [MinVersion=5] OnAccountInfoReady(AccountInfo? account_info);
};