Commit ff15c074 authored by Roger Tawa's avatar Roger Tawa Committed by Commit Bot

Replace access token with id token during MDM registration.

Bug: 898303
Change-Id: Icbc202b2924ebca3bd633073175f216b47a858d0
Reviewed-on: https://chromium-review.googlesource.com/c/1297449
Commit-Queue: Roger Tawa <rogerta@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603095}
parent 2eb52a2d
......@@ -152,7 +152,7 @@ void CALLBACK SaveAccountInfoW(HWND /*hwnd*/,
std::unique_ptr<base::Value> properties =
base::JSONReader::Read(buffer, base::JSON_ALLOW_TRAILING_COMMAS);
if (!properties || !properties->GetAsDictionary(&dict)) {
LOGFN(ERROR) << "base::JSONReader::Read failed";
LOGFN(ERROR) << "base::JSONReader::Read failed length=" << buffer_len_bytes;
hr = E_FAIL;
}
......
......@@ -181,9 +181,9 @@ HRESULT ValidateAndFixResult(base::DictionaryValue* result, BSTR* status_text) {
has_error = true;
}
std::string mdm_access_token = GetDictStringUTF8(result, kKeyMdmAcessToken);
if (mdm_access_token.empty()) {
LOGFN(ERROR) << "mdm access token is empty";
std::string mdm_id_token = GetDictStringUTF8(result, kKeyMdmIdToken);
if (mdm_id_token.empty()) {
LOGFN(ERROR) << "mdm id token is empty";
has_error = true;
}
......
......@@ -45,7 +45,7 @@ class ATL_NO_VTABLE CGaiaCredentialBase
public:
// Size in wchar_t of string buffer to pass account information to background
// process to save that information into the registry.
static const int kAccountInfoBufferSize = 1024;
static const int kAccountInfoBufferSize = 2048;
// Called when the DLL is registered or unregistered.
static HRESULT OnDllRegisterServer();
......
......@@ -163,7 +163,7 @@ HRESULT CTestCredential::GetGlsCommandline(const wchar_t* /*email*/,
dict.SetString(kKeyEmail, gls_email_);
dict.SetString(kKeyFullname, "Full Name");
dict.SetString(kKeyId, "1234567890");
dict.SetString(kKeyMdmAcessToken, "oat-123456");
dict.SetString(kKeyMdmIdToken, "idt-123456");
dict.SetString(kKeyPassword, "password");
dict.SetString(kKeyRefreshToken, "rt-123456");
dict.SetString(kKeyTokenHandle, "th-123456");
......
......@@ -11,7 +11,7 @@ const char kKeyEmail[] = "email";
const char kKeyFullname[] = "full_name";
const char kKeyId[] = "id";
const char kKeyMdmUrl[] = "mdm_url";
const char kKeyMdmAcessToken[] = "mdm_access_token";
const char kKeyMdmIdToken[] = "mdm_id_token";
const char kKeyPassword[] = "password";
const char kKeyRefreshToken[] = "refresh_token";
const char kKeySID[] = "sid";
......
......@@ -12,7 +12,7 @@ extern const char kKeyEmail[];
extern const char kKeyFullname[];
extern const char kKeyId[];
extern const char kKeyMdmUrl[];
extern const char kKeyMdmAcessToken[];
extern const char kKeyMdmIdToken[];
extern const char kKeyPassword[];
extern const char kKeyRefreshToken[];
extern const char kKeySID[];
......
......@@ -530,7 +530,7 @@ HRESULT EnrollToGoogleMdmIfNeeded(const base::DictionaryValue& properties) {
if (!is_registered) {
base::string16 email = GetDictString(&properties, kKeyEmail);
base::string16 token = GetDictString(&properties, kKeyMdmAcessToken);
base::string16 token = GetDictString(&properties, kKeyMdmIdToken);
base::string16 mdm_url = GetDictString(&properties, kKeyMdmUrl);
if (email.empty()) {
......@@ -539,7 +539,7 @@ HRESULT EnrollToGoogleMdmIfNeeded(const base::DictionaryValue& properties) {
}
if (token.empty()) {
LOGFN(ERROR) << "MDM access token is empty";
LOGFN(ERROR) << "MDM id token is empty";
return E_INVALIDARG;
}
......@@ -561,7 +561,7 @@ HRESULT EnrollToGoogleMdmIfNeeded(const base::DictionaryValue& properties) {
}
registration_data.SetString("serial_number", serial_number);
registration_data.SetString("access_token", token);
registration_data.SetString("id_token", token);
std::string registration_data_str;
if (!base::JSONWriter::Write(registration_data, &registration_data_str)) {
LOGFN(ERROR) << "JSONWriter::Write(registration_data)";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment