diff options
-rw-r--r-- | chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc | 17 | ||||
-rw-r--r-- | chromeos/chromeos_switches.cc | 5 | ||||
-rw-r--r-- | chromeos/chromeos_switches.h | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc index 49f97a8..0cbf646 100644 --- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc +++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc @@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" #include "base/bind.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/browser_process.h" @@ -14,6 +15,7 @@ #include "chrome/browser/policy/cloud/cloud_policy_constants.h" #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" +#include "chromeos/chromeos_switches.h" #include "google_apis/gaia/gaia_urls.h" #include "net/http/http_status_code.h" @@ -28,6 +30,11 @@ const int kLockRetryIntervalMs = 500; // Maximum time to retry InstallAttrs initialization before we give up. const int kLockRetryTimeoutMs = 10 * 60 * 1000; // 10 minutes. +// Testing token used when the enrollment-skip-robot-auth is set to skip talking +// to GAIA for an actual token. This is needed to be able to run against the +// testing DMServer implementations. +const char kTestingRobotToken[] = "test-token"; + } // namespace EnrollmentHandlerChromeOS::EnrollmentHandlerChromeOS( @@ -187,6 +194,16 @@ void EnrollmentHandlerChromeOS::PolicyValidated( username_ = validator->policy_data()->username(); device_id_ = validator->policy_data()->device_id(); + if (CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kEnterpriseEnrollmentSkipRobotAuth)) { + // For test purposes we allow enrollment to succeed without proper robot + // account and use the provided value as a token. + refresh_token_ = kTestingRobotToken; + enrollment_step_ = STEP_LOCK_DEVICE, + StartLockDevice(username_, device_mode_, device_id_); + return; + } + enrollment_step_ = STEP_ROBOT_AUTH_FETCH; client_->FetchRobotAuthCodes(auth_token_); } else { diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index 714adaf..46052d8 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc @@ -117,6 +117,11 @@ const char kEnterpriseEnrollmentInitialModulus[] = const char kEnterpriseEnrollmentModulusLimit[] = "enterprise-enrollment-modulus-limit"; +// Don't create robot account on enrollment. Used when testing device +// enrollment against YAPS or the Python test server. +const char kEnterpriseEnrollmentSkipRobotAuth[] = + "enterprise-enrollment-skip-robot-auth"; + // Shows the selecting checkboxes in the Files.app. const char kFileManagerShowCheckboxes[] = "file-manager-show-checkboxes"; diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 32e3cfe..e5226df 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h @@ -50,6 +50,7 @@ CHROMEOS_EXPORT extern const char kEnableStubPortalledWifi[]; CHROMEOS_EXPORT extern const char kEnableTouchpadThreeFingerClick[]; CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentInitialModulus[]; CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentModulusLimit[]; +CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentSkipRobotAuth[]; CHROMEOS_EXPORT extern const char kFileManagerShowCheckboxes[]; CHROMEOS_EXPORT extern const char kFileManagerEnableWebstoreIntegration[]; CHROMEOS_EXPORT extern const char kFirstExecAfterBoot[]; |