| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gaia_auth_fetcher.h" | 5 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 encoded_source.c_str()); | 438 encoded_source.c_str()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 // static | 441 // static |
| 442 std::string GaiaAuthFetcher::MakeListIDPSessionsBody( | 442 std::string GaiaAuthFetcher::MakeListIDPSessionsBody( |
| 443 const std::string& scopes, | 443 const std::string& scopes, |
| 444 const std::string& domain) { | 444 const std::string& domain) { |
| 445 static const char getTokenResponseBodyFormat[] = | 445 static const char getTokenResponseBodyFormat[] = |
| 446 "action=listSessions&" | 446 "action=listSessions&" |
| 447 "client_id=%s&" | 447 "client_id=%s&" |
| 448 "e=3100087&" // temporarily enable the experiment. | |
| 449 "origin=%s&" | 448 "origin=%s&" |
| 450 "scope=%s"; | 449 "scope=%s"; |
| 451 std::string encoded_client_id = net::EscapeUrlEncodedData( | 450 std::string encoded_client_id = net::EscapeUrlEncodedData( |
| 452 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true); | 451 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true); |
| 453 return base::StringPrintf(getTokenResponseBodyFormat, | 452 return base::StringPrintf(getTokenResponseBodyFormat, |
| 454 encoded_client_id.c_str(), | 453 encoded_client_id.c_str(), |
| 455 domain.c_str(), | 454 domain.c_str(), |
| 456 scopes.c_str()); | 455 scopes.c_str()); |
| 457 } | 456 } |
| 458 | 457 |
| 459 std::string GaiaAuthFetcher::MakeGetTokenResponseBody( | 458 std::string GaiaAuthFetcher::MakeGetTokenResponseBody( |
| 460 const std::string& scopes, | 459 const std::string& scopes, |
| 461 const std::string& domain, | 460 const std::string& domain, |
| 462 const std::string& login_hint) { | 461 const std::string& login_hint) { |
| 463 static const char getTokenResponseBodyFormat[] = | 462 static const char getTokenResponseBodyFormat[] = |
| 464 "action=issueToken&" | 463 "action=issueToken&" |
| 465 "client_id=%s&" | 464 "client_id=%s&" |
| 466 "login_hint=%s&" | 465 "login_hint=%s&" |
| 467 "origin=%s&" | 466 "origin=%s&" |
| 468 "e=3100087&" // temporarily enable the experiment. | |
| 469 "response_type=token&" | 467 "response_type=token&" |
| 470 "scope=%s"; | 468 "scope=%s"; |
| 471 std::string encoded_client_id = net::EscapeUrlEncodedData( | 469 std::string encoded_client_id = net::EscapeUrlEncodedData( |
| 472 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true); | 470 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true); |
| 473 return base::StringPrintf(getTokenResponseBodyFormat, | 471 return base::StringPrintf(getTokenResponseBodyFormat, |
| 474 encoded_client_id.c_str(), | 472 encoded_client_id.c_str(), |
| 475 login_hint.c_str(), | 473 login_hint.c_str(), |
| 476 domain.c_str(), | 474 domain.c_str(), |
| 477 scopes.c_str()); | 475 scopes.c_str()); |
| 478 } | 476 } |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 return alleged_error.find(kSecondFactor) != | 1153 return alleged_error.find(kSecondFactor) != |
| 1156 std::string::npos; | 1154 std::string::npos; |
| 1157 } | 1155 } |
| 1158 | 1156 |
| 1159 // static | 1157 // static |
| 1160 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 1158 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
| 1161 const std::string& alleged_error) { | 1159 const std::string& alleged_error) { |
| 1162 return alleged_error.find(kWebLoginRequired) != | 1160 return alleged_error.find(kWebLoginRequired) != |
| 1163 std::string::npos; | 1161 std::string::npos; |
| 1164 } | 1162 } |
| OLD | NEW |