in src/oslogin_utils.cc [1246:1286]
bool ContinueSession(bool alt, const string& email, const string& user_token, const string& session_id, const Challenge& challenge, string* response) {
bool ret = true;
json_object* jobj = NULL;
json_object* jresp = NULL;
jobj = json_object_new_object();
json_object_object_add(jobj, "email", json_object_new_string(email.c_str()));
json_object_object_add(jobj, "challengeId",
json_object_new_int(challenge.id));
if (alt) {
json_object_object_add(jobj, "action",
json_object_new_string("START_ALTERNATE"));
} else {
json_object_object_add(jobj, "action", json_object_new_string("RESPOND"));
}
// AUTHZEN type and START_ALTERNATE action don't provide credentials.
if (challenge.type != AUTHZEN && !alt) {
jresp = json_object_new_object();
json_object_object_add(jresp, "credential",
json_object_new_string(user_token.c_str()));
json_object_object_add(jobj, "proposalResponse", jresp); // Ownership transferred to jobj.
}
const char* data = NULL;
data = json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PLAIN);
std::stringstream url;
url << kMetadataServerUrl << "authenticate/sessions/" << session_id
<< "/continue";
long http_code = 0;
if (!HttpPost(url.str(), data, response, &http_code) || response->empty() ||
http_code != 200) {
ret = false;
}
json_object_put(jobj);
return ret;
}