OLD | NEW |
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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (iter != request.headers.end()) { | 78 if (iter != request.headers.end()) { |
79 for (const std::string& cookie_line : | 79 for (const std::string& cookie_line : |
80 base::SplitString(iter->second, " ", base::TRIM_WHITESPACE, | 80 base::SplitString(iter->second, " ", base::TRIM_WHITESPACE, |
81 base::SPLIT_WANT_ALL)) { | 81 base::SPLIT_WANT_ALL)) { |
82 std::vector<std::string> name_value = base::SplitString( | 82 std::vector<std::string> name_value = base::SplitString( |
83 cookie_line, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 83 cookie_line, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
84 if (name_value.size() != 2) | 84 if (name_value.size() != 2) |
85 continue; | 85 continue; |
86 | 86 |
87 std::string value = name_value[1]; | 87 std::string value = name_value[1]; |
88 if (value.size() && value[value.size() - 1] == ';') | 88 if (value.size() && value.back() == ';') |
89 value = value.substr(0, value.size() -1); | 89 value = value.substr(0, value.size() -1); |
90 | 90 |
91 result.insert(std::make_pair(name_value[0], value)); | 91 result.insert(std::make_pair(name_value[0], value)); |
92 } | 92 } |
93 } | 93 } |
94 return result; | 94 return result; |
95 } | 95 } |
96 | 96 |
97 // Extracts the |access_token| from authorization header of |request|. | 97 // Extracts the |access_token| from authorization header of |request|. |
98 bool GetAccessToken(const HttpRequest& request, | 98 bool GetAccessToken(const HttpRequest& request, |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 url = net::AppendQueryParameter(url, "RelayState", | 833 url = net::AppendQueryParameter(url, "RelayState", |
834 GaiaUrls::GetInstance() | 834 GaiaUrls::GetInstance() |
835 ->gaia_url() | 835 ->gaia_url() |
836 .Resolve(kDummySAMLContinuePath) | 836 .Resolve(kDummySAMLContinuePath) |
837 .spec()); | 837 .spec()); |
838 std::string redirect_url = url.spec(); | 838 std::string redirect_url = url.spec(); |
839 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); | 839 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); |
840 http_response->AddCustomHeader("Google-Accounts-SAML", "Start"); | 840 http_response->AddCustomHeader("Google-Accounts-SAML", "Start"); |
841 http_response->AddCustomHeader("Location", redirect_url); | 841 http_response->AddCustomHeader("Location", redirect_url); |
842 } | 842 } |
OLD | NEW |