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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 base::SplitString(cookie, ';', &parts); | 512 base::SplitString(cookie, ';', &parts); |
513 // Per documentation, the cookie should have Secure and HttpOnly. | 513 // Per documentation, the cookie should have Secure and HttpOnly. |
514 if (!CookiePartsContains(parts, kClientLoginToOAuth2CookiePartSecure) || | 514 if (!CookiePartsContains(parts, kClientLoginToOAuth2CookiePartSecure) || |
515 !CookiePartsContains(parts, kClientLoginToOAuth2CookiePartHttpOnly)) { | 515 !CookiePartsContains(parts, kClientLoginToOAuth2CookiePartHttpOnly)) { |
516 return false; | 516 return false; |
517 } | 517 } |
518 | 518 |
519 std::vector<std::string>::const_iterator iter; | 519 std::vector<std::string>::const_iterator iter; |
520 for (iter = parts.begin(); iter != parts.end(); ++iter) { | 520 for (iter = parts.begin(); iter != parts.end(); ++iter) { |
521 const std::string& part = *iter; | 521 const std::string& part = *iter; |
522 if (base::StartsWithASCII(part, kClientLoginToOAuth2CookiePartCodePrefix, | 522 if (base::StartsWith(part, kClientLoginToOAuth2CookiePartCodePrefix, |
523 false)) { | 523 base::CompareCase::INSENSITIVE_ASCII)) { |
524 auth_code->assign(part.substr( | 524 auth_code->assign(part.substr( |
525 kClientLoginToOAuth2CookiePartCodePrefixLength)); | 525 kClientLoginToOAuth2CookiePartCodePrefixLength)); |
526 return true; | 526 return true; |
527 } | 527 } |
528 } | 528 } |
529 return false; | 529 return false; |
530 } | 530 } |
531 | 531 |
532 // static | 532 // static |
533 bool GaiaAuthFetcher::ParseListIdpSessionsResponse(const std::string& data, | 533 bool GaiaAuthFetcher::ParseListIdpSessionsResponse(const std::string& data, |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 void GaiaAuthFetcher::DispatchFetchedRequest( | 1044 void GaiaAuthFetcher::DispatchFetchedRequest( |
1045 const GURL& url, | 1045 const GURL& url, |
1046 const std::string& data, | 1046 const std::string& data, |
1047 const net::ResponseCookies& cookies, | 1047 const net::ResponseCookies& cookies, |
1048 const net::URLRequestStatus& status, | 1048 const net::URLRequestStatus& status, |
1049 int response_code) { | 1049 int response_code) { |
1050 if (url == client_login_gurl_) { | 1050 if (url == client_login_gurl_) { |
1051 OnClientLoginFetched(data, status, response_code); | 1051 OnClientLoginFetched(data, status, response_code); |
1052 } else if (url == issue_auth_token_gurl_) { | 1052 } else if (url == issue_auth_token_gurl_) { |
1053 OnIssueAuthTokenFetched(data, status, response_code); | 1053 OnIssueAuthTokenFetched(data, status, response_code); |
1054 } else if (base::StartsWithASCII(url.spec(), | 1054 } else if (base::StartsWith(url.spec(), |
1055 client_login_to_oauth2_gurl_.spec(), true)) { | 1055 client_login_to_oauth2_gurl_.spec(), |
| 1056 base::CompareCase::SENSITIVE)) { |
1056 OnClientLoginToOAuth2Fetched(data, cookies, status, response_code); | 1057 OnClientLoginToOAuth2Fetched(data, cookies, status, response_code); |
1057 } else if (url == oauth2_token_gurl_) { | 1058 } else if (url == oauth2_token_gurl_) { |
1058 OnOAuth2TokenPairFetched(data, status, response_code); | 1059 OnOAuth2TokenPairFetched(data, status, response_code); |
1059 } else if (url == get_user_info_gurl_) { | 1060 } else if (url == get_user_info_gurl_) { |
1060 OnGetUserInfoFetched(data, status, response_code); | 1061 OnGetUserInfoFetched(data, status, response_code); |
1061 } else if (url == merge_session_gurl_) { | 1062 } else if (url == merge_session_gurl_) { |
1062 OnMergeSessionFetched(data, status, response_code); | 1063 OnMergeSessionFetched(data, status, response_code); |
1063 } else if (url == uberauth_token_gurl_) { | 1064 } else if (url == uberauth_token_gurl_) { |
1064 OnUberAuthTokenFetch(data, status, response_code); | 1065 OnUberAuthTokenFetch(data, status, response_code); |
1065 } else if (url == oauth_login_gurl_) { | 1066 } else if (url == oauth_login_gurl_) { |
(...skipping 24 matching lines...) Expand all Loading... |
1090 return alleged_error.find(kSecondFactor) != | 1091 return alleged_error.find(kSecondFactor) != |
1091 std::string::npos; | 1092 std::string::npos; |
1092 } | 1093 } |
1093 | 1094 |
1094 // static | 1095 // static |
1095 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 1096 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
1096 const std::string& alleged_error) { | 1097 const std::string& alleged_error) { |
1097 return alleged_error.find(kWebLoginRequired) != | 1098 return alleged_error.find(kWebLoginRequired) != |
1098 std::string::npos; | 1099 std::string::npos; |
1099 } | 1100 } |
OLD | NEW |