Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 13 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 14 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | |
| 14 | 15 |
| 15 class GoogleServiceAuthError; | 16 class GoogleServiceAuthError; |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 struct EnrollmentConfig; | 19 struct EnrollmentConfig; |
| 19 class EnrollmentStatus; | 20 class EnrollmentStatus; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 25 // Maps a license type to number of available licenses. | |
| 26 using EnrollmentLicenseMap = std::map<policy::LicenseType, int>; | |
|
emaxx
2017/07/21 12:57:29
nit: #include <map>
Denis Kuznetsov (DE-MUC)
2017/07/25 21:51:05
Done.
| |
| 27 | |
| 24 class ActiveDirectoryJoinDelegate; | 28 class ActiveDirectoryJoinDelegate; |
| 25 | 29 |
| 26 // This class is capable to enroll the device into enterprise domain, using | 30 // This class is capable to enroll the device into enterprise domain, using |
| 27 // either a profile containing authentication data or OAuth token. | 31 // either a profile containing authentication data or OAuth token. |
| 28 // It can also clear an authentication data from the profile and revoke tokens | 32 // It can also clear an authentication data from the profile and revoke tokens |
| 29 // that are not longer needed. | 33 // that are not longer needed. |
| 30 class EnterpriseEnrollmentHelper { | 34 class EnterpriseEnrollmentHelper { |
| 31 public: | 35 public: |
| 32 typedef policy::DeviceCloudPolicyInitializer::EnrollmentCallback | 36 typedef policy::DeviceCloudPolicyInitializer::EnrollmentCallback |
| 33 EnrollmentCallback; | 37 EnrollmentCallback; |
| 34 | 38 |
| 35 // Enumeration of the possible errors that can occur during enrollment which | 39 // Enumeration of the possible errors that can occur during enrollment which |
| 36 // are not covered by GoogleServiceAuthError or EnrollmentStatus. | 40 // are not covered by GoogleServiceAuthError or EnrollmentStatus. |
| 37 enum OtherError { | 41 enum OtherError { |
| 38 // Existing enrollment domain doesn't match authentication user. | 42 // Existing enrollment domain doesn't match authentication user. |
| 39 OTHER_ERROR_DOMAIN_MISMATCH, | 43 OTHER_ERROR_DOMAIN_MISMATCH, |
| 40 // Unexpected error condition, indicates a bug in the code. | 44 // Unexpected error condition, indicates a bug in the code. |
| 41 OTHER_ERROR_FATAL | 45 OTHER_ERROR_FATAL |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 class EnrollmentStatusConsumer { | 48 class EnrollmentStatusConsumer { |
| 45 public: | 49 public: |
| 46 // Called when an error happens on attempt to receive authentication tokens. | 50 // Called when an error happens on attempt to receive authentication tokens. |
| 47 virtual void OnAuthError(const GoogleServiceAuthError& error) = 0; | 51 virtual void OnAuthError(const GoogleServiceAuthError& error) = 0; |
| 48 | 52 |
| 53 // Called when there are multiple license types available for enrollment, | |
| 54 // and admin allowed customer to choose license type to assign. | |
|
emaxx
2017/07/21 12:57:29
nit: s/customer/user/? (IIUC)
Denis Kuznetsov (DE-MUC)
2017/07/25 21:51:05
Done.
| |
| 55 // Enrollment is paused, and will resume once UseLicenseType() is called. | |
| 56 virtual void OnMultipleLicensesAvailable( | |
| 57 const EnrollmentLicenseMap& licenses) = 0; | |
| 58 | |
| 49 // Called when an error happens during enrollment. | 59 // Called when an error happens during enrollment. |
| 50 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0; | 60 virtual void OnEnrollmentError(policy::EnrollmentStatus status) = 0; |
| 51 | 61 |
| 52 // Called when some other error happens. | 62 // Called when some other error happens. |
| 53 virtual void OnOtherError(OtherError error) = 0; | 63 virtual void OnOtherError(OtherError error) = 0; |
| 54 | 64 |
| 55 // Called when enrollment finishes successfully. |additional_token| keeps | 65 // Called when enrollment finishes successfully. |additional_token| keeps |
| 56 // the additional access token, if it was requested by setting the | 66 // the additional access token, if it was requested by setting the |
| 57 // |fetch_additional_token| param of EnrollUsingProfile() to true. | 67 // |fetch_additional_token| param of EnrollUsingProfile() to true. |
| 58 // Otherwise, |additional_token| is empty. | 68 // Otherwise, |additional_token| is empty. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 // Starts enterprise enrollment using |token|. | 109 // Starts enterprise enrollment using |token|. |
| 100 // EnrollUsingToken can be called only once during this object's lifetime, and | 110 // EnrollUsingToken can be called only once during this object's lifetime, and |
| 101 // only if none of the EnrollUsing* was called before. | 111 // only if none of the EnrollUsing* was called before. |
| 102 virtual void EnrollUsingToken(const std::string& token) = 0; | 112 virtual void EnrollUsingToken(const std::string& token) = 0; |
| 103 | 113 |
| 104 // Starts enterprise enrollment using PCA attestation. | 114 // Starts enterprise enrollment using PCA attestation. |
| 105 // EnrollUsingAttestation can be called only once during the object's | 115 // EnrollUsingAttestation can be called only once during the object's |
| 106 // lifetime, and only if none of the EnrollUsing* was called before. | 116 // lifetime, and only if none of the EnrollUsing* was called before. |
| 107 virtual void EnrollUsingAttestation() = 0; | 117 virtual void EnrollUsingAttestation() = 0; |
| 108 | 118 |
| 119 // Continue enrollment using license |type|. | |
| 120 virtual void UseLicenseType(policy::LicenseType type) = 0; | |
| 121 | |
| 109 // Starts device attribute update process. First tries to get | 122 // Starts device attribute update process. First tries to get |
| 110 // permission to update device attributes for current user | 123 // permission to update device attributes for current user |
| 111 // using stored during enrollment oauth token. | 124 // using stored during enrollment oauth token. |
| 112 virtual void GetDeviceAttributeUpdatePermission() = 0; | 125 virtual void GetDeviceAttributeUpdatePermission() = 0; |
| 113 | 126 |
| 114 // Uploads device attributes on DM server. |asset_id| - Asset Identifier | 127 // Uploads device attributes on DM server. |asset_id| - Asset Identifier |
| 115 // and |location| - Assigned Location, these attributes were typed by | 128 // and |location| - Assigned Location, these attributes were typed by |
| 116 // current user on the device attribute prompt screen after successful | 129 // current user on the device attribute prompt screen after successful |
| 117 // enrollment. | 130 // enrollment. |
| 118 virtual void UpdateDeviceAttributes(const std::string& asset_id, | 131 virtual void UpdateDeviceAttributes(const std::string& asset_id, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 139 // If this is not nullptr, then it will be used to create the enrollment | 152 // If this is not nullptr, then it will be used to create the enrollment |
| 140 // helper. |create_mock_enrollment_helper_| needs to outlive this class. | 153 // helper. |create_mock_enrollment_helper_| needs to outlive this class. |
| 141 static CreateMockEnrollmentHelper create_mock_enrollment_helper_; | 154 static CreateMockEnrollmentHelper create_mock_enrollment_helper_; |
| 142 | 155 |
| 143 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper); | 156 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentHelper); |
| 144 }; | 157 }; |
| 145 | 158 |
| 146 } // namespace chromeos | 159 } // namespace chromeos |
| 147 | 160 |
| 148 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_ | 161 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENTERPRISE_ENROLLMENT_HELPER _H_ |
| OLD | NEW |