Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 // explicitly to make it easier to read debug logs.) | 104 // explicitly to make it easier to read debug logs.) |
| 105 enum EnrollmentStep { | 105 enum EnrollmentStep { |
| 106 STEP_PENDING = 0, // Not started yet. | 106 STEP_PENDING = 0, // Not started yet. |
| 107 STEP_STATE_KEYS = 1, // Waiting for state keys to become available. | 107 STEP_STATE_KEYS = 1, // Waiting for state keys to become available. |
| 108 STEP_LOADING_STORE = 2, // Waiting for |store_| to initialize. | 108 STEP_LOADING_STORE = 2, // Waiting for |store_| to initialize. |
| 109 STEP_REGISTRATION = 3, // Currently registering the client. | 109 STEP_REGISTRATION = 3, // Currently registering the client. |
| 110 STEP_POLICY_FETCH = 4, // Fetching policy. | 110 STEP_POLICY_FETCH = 4, // Fetching policy. |
| 111 STEP_VALIDATION = 5, // Policy validation. | 111 STEP_VALIDATION = 5, // Policy validation. |
| 112 STEP_ROBOT_AUTH_FETCH = 6, // Fetching device API auth code. | 112 STEP_ROBOT_AUTH_FETCH = 6, // Fetching device API auth code. |
| 113 STEP_ROBOT_AUTH_REFRESH = 7, // Fetching device API refresh token. | 113 STEP_ROBOT_AUTH_REFRESH = 7, // Fetching device API refresh token. |
| 114 STEP_LOCK_DEVICE = 8, // Writing installation-time attributes. | 114 STEP_AD_DOMAIN_JOIN = 8, // Joining Active Directory domain. |
| 115 STEP_STORE_TOKEN = 9, // Encrypting and storing DM token. | 115 STEP_LOCK_DEVICE = 9, // Writing installation-time attributes. |
| 116 STEP_STORE_ROBOT_AUTH = 10, // Encrypting & writing robot refresh token. | 116 STEP_STORE_TOKEN = 10, // Encrypting and storing DM token. |
| 117 STEP_STORE_POLICY = 11, // Storing policy and API refresh token. For | 117 STEP_STORE_ROBOT_AUTH = 11, // Encrypting & writing robot refresh token. |
| 118 STEP_STORE_POLICY = 12, // Storing policy and API refresh token. For | |
| 118 // AD, includes policy fetch via authpolicyd. | 119 // AD, includes policy fetch via authpolicyd. |
| 119 STEP_FINISHED = 12, // Enrollment process done, no further action. | 120 STEP_FINISHED = 13, // Enrollment process done, no further action. |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 // Handles the response to a request for server-backed state keys. | 123 // Handles the response to a request for server-backed state keys. |
| 123 void HandleStateKeysResult(const std::vector<std::string>& state_keys); | 124 void HandleStateKeysResult(const std::vector<std::string>& state_keys); |
| 124 | 125 |
| 125 // Starts attestation based enrollment flow. | 126 // Starts attestation based enrollment flow. |
| 126 void StartAttestationBasedEnrollmentFlow(); | 127 void StartAttestationBasedEnrollmentFlow(); |
| 127 | 128 |
| 128 // Handles the response to a request for a registration certificate. | 129 // Handles the response to a request for a registration certificate. |
| 129 void HandleRegistrationCertificateResult( | 130 void HandleRegistrationCertificateResult( |
| 130 bool success, | 131 bool success, |
| 131 const std::string& pem_certificate_chain); | 132 const std::string& pem_certificate_chain); |
| 132 | 133 |
| 133 // Starts registration if the store is initialized. | 134 // Starts registration if the store is initialized. |
| 134 void StartRegistration(); | 135 void StartRegistration(); |
| 135 | 136 |
| 136 // Handles the policy validation result, proceeding with device lock if | 137 // Handles the policy validation result, proceeding with device lock if |
| 137 // successful. | 138 // successful. |
| 138 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); | 139 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); |
| 139 | 140 |
| 141 // Start joining to Active Directory domain in case device is enrolling into | |
|
achuithb
2017/02/07 20:27:17
Start joining the Active Directory domain in case
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 142 // Active Directory management mode. | |
| 143 void StartJoinAdDomain(); | |
| 144 | |
| 145 // Handles successful Active Directory domain join. | |
| 146 void OnAdDomainJoined(std::string realm); | |
|
achuithb
2017/02/07 20:27:16
const std::string&
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 147 | |
| 140 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 148 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
| 141 // DeviceSettingsService::SetManagementSettings() for consumer | 149 // DeviceSettingsService::SetManagementSettings() for consumer |
| 142 // enrollment. | 150 // enrollment. |
| 143 void StartLockDevice(); | 151 void StartLockDevice(); |
| 144 | 152 |
| 145 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 153 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
| 146 void HandleLockDeviceResult( | 154 void HandleLockDeviceResult( |
| 147 chromeos::InstallAttributes::LockResult lock_result); | 155 chromeos::InstallAttributes::LockResult lock_result); |
| 148 | 156 |
| 149 // Initiates storing DM token. For Active Directory devices only. | 157 // Initiates storing DM token. For Active Directory devices only. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 EnrollmentConfig enrollment_config_; | 190 EnrollmentConfig enrollment_config_; |
| 183 std::string auth_token_; | 191 std::string auth_token_; |
| 184 std::string client_id_; | 192 std::string client_id_; |
| 185 std::string requisition_; | 193 std::string requisition_; |
| 186 EnrollmentCallback completion_callback_; | 194 EnrollmentCallback completion_callback_; |
| 187 | 195 |
| 188 // The current state key provided by |state_keys_broker_|. | 196 // The current state key provided by |state_keys_broker_|. |
| 189 std::string current_state_key_; | 197 std::string current_state_key_; |
| 190 | 198 |
| 191 // The device mode as received in the registration request. | 199 // The device mode as received in the registration request. |
| 192 DeviceMode device_mode_; | 200 DeviceMode device_mode_; |
|
achuithb
2017/02/07 20:27:17
initialize this
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 193 | 201 |
| 194 // Whether the server signaled to skip robot auth setup. | 202 // Whether the server signaled to skip robot auth setup. |
| 195 bool skip_robot_auth_; | 203 bool skip_robot_auth_; |
|
achuithb
2017/02/07 20:27:17
initialize this.
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 196 | 204 |
| 197 // The robot account refresh token. | 205 // The robot account refresh token. |
| 198 std::string robot_refresh_token_; | 206 std::string robot_refresh_token_; |
| 199 | 207 |
| 200 // The validated policy response info to be installed in the store. | 208 // The validated policy response info to be installed in the store. |
| 201 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_; | 209 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_; |
| 202 std::string domain_; | 210 std::string domain_; |
| 211 std::string realm_; | |
| 203 std::string device_id_; | 212 std::string device_id_; |
| 204 | 213 |
| 205 // Current enrollment step. | 214 // Current enrollment step. |
| 206 EnrollmentStep enrollment_step_; | 215 EnrollmentStep enrollment_step_; |
| 207 | 216 |
| 208 // Total amount of time in milliseconds spent waiting for lockbox | 217 // Total amount of time in milliseconds spent waiting for lockbox |
| 209 // initialization. | 218 // initialization. |
| 210 int lockbox_init_duration_; | 219 int lockbox_init_duration_; |
|
achuithb
2017/02/07 20:27:16
initialize this
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 211 | 220 |
| 212 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 221 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 213 | 222 |
| 214 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 223 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 215 }; | 224 }; |
| 216 | 225 |
| 217 } // namespace policy | 226 } // namespace policy |
| 218 | 227 |
| 219 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 228 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |