Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: google_apis/gaia/fake_gaia.cc

Issue 1138143002: Pass Device ID in the oauth2/token request. Keep Device ID in local state on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "google_apis/gaia/fake_gaia.h" 5 #include "google_apis/gaia/fake_gaia.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 595
596 if (grant_type == "authorization_code") { 596 if (grant_type == "authorization_code") {
597 std::string auth_code; 597 std::string auth_code;
598 if (!GetQueryParameter(request.content, "code", &auth_code) || 598 if (!GetQueryParameter(request.content, "code", &auth_code) ||
599 auth_code != merge_session_params_.auth_code) { 599 auth_code != merge_session_params_.auth_code) {
600 http_response->set_code(net::HTTP_BAD_REQUEST); 600 http_response->set_code(net::HTTP_BAD_REQUEST);
601 LOG(ERROR) << "No 'code' param in /o/oauth2/token"; 601 LOG(ERROR) << "No 'code' param in /o/oauth2/token";
602 return; 602 return;
603 } 603 }
604 604
605 std::string device_id;
606 if (GetQueryParameter(request.content, "device_id", &device_id)) {
607 std::string device_type;
608 if (!GetQueryParameter(request.content, "device_type", &device_type)) {
609 http_response->set_code(net::HTTP_BAD_REQUEST);
610 LOG(ERROR) << "'device_type' should be set if 'device_id' is set.";
611 return;
612 }
613 if (device_type != "chrome") {
614 http_response->set_code(net::HTTP_BAD_REQUEST);
615 LOG(ERROR) << "'device_type' is not 'chrome'.";
616 return;
617 }
618 }
619
605 base::DictionaryValue response_dict; 620 base::DictionaryValue response_dict;
606 response_dict.SetString("refresh_token", 621 response_dict.SetString("refresh_token",
607 merge_session_params_.refresh_token); 622 merge_session_params_.refresh_token);
608 response_dict.SetString("access_token", 623 response_dict.SetString("access_token",
609 merge_session_params_.access_token); 624 merge_session_params_.access_token);
610 response_dict.SetInteger("expires_in", 3600); 625 response_dict.SetInteger("expires_in", 3600);
611 FormatJSONResponse(response_dict, http_response); 626 FormatJSONResponse(response_dict, http_response);
612 return; 627 return;
613 } 628 }
614 629
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 if (token_info) { 727 if (token_info) {
713 base::DictionaryValue response_dict; 728 base::DictionaryValue response_dict;
714 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); 729 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email));
715 response_dict.SetString("email", token_info->email); 730 response_dict.SetString("email", token_info->email);
716 response_dict.SetString("verified_email", token_info->email); 731 response_dict.SetString("verified_email", token_info->email);
717 FormatJSONResponse(response_dict, http_response); 732 FormatJSONResponse(response_dict, http_response);
718 } else { 733 } else {
719 http_response->set_code(net::HTTP_BAD_REQUEST); 734 http_response->set_code(net::HTTP_BAD_REQUEST);
720 } 735 }
721 } 736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698