OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/net/gaia/oauth_request_signer.h" | 5 #include "chrome/common/net/gaia/oauth_request_signer.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return "RSA-SHA1"; | 71 return "RSA-SHA1"; |
72 case OAuthRequestSigner::PLAINTEXT_SIGNATURE: | 72 case OAuthRequestSigner::PLAINTEXT_SIGNATURE: |
73 return "PLAINTEXT"; | 73 return "PLAINTEXT"; |
74 } | 74 } |
75 NOTREACHED(); | 75 NOTREACHED(); |
76 return *(new std::string()); | 76 return *(new std::string()); |
77 } | 77 } |
78 | 78 |
79 std::string BuildBaseString(const GURL& request_base_url, | 79 std::string BuildBaseString(const GURL& request_base_url, |
80 OAuthRequestSigner::HttpMethod http_method, | 80 OAuthRequestSigner::HttpMethod http_method, |
81 const std::string base_parameters) { | 81 const std::string& base_parameters) { |
82 return StringPrintf("%s&%s&%s", | 82 return StringPrintf("%s&%s&%s", |
83 HttpMethodName(http_method).c_str(), | 83 HttpMethodName(http_method).c_str(), |
84 OAuthRequestSigner::Encode( | 84 OAuthRequestSigner::Encode( |
85 request_base_url.spec()).c_str(), | 85 request_base_url.spec()).c_str(), |
86 OAuthRequestSigner::Encode( | 86 OAuthRequestSigner::Encode( |
87 base_parameters).c_str()); | 87 base_parameters).c_str()); |
88 } | 88 } |
89 | 89 |
90 std::string BuildBaseStringParameters( | 90 std::string BuildBaseStringParameters( |
91 const OAuthRequestSigner::Parameters& parameters) { | 91 const OAuthRequestSigner::Parameters& parameters) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 signed_text += ", "; | 449 signed_text += ", "; |
450 signed_text += | 450 signed_text += |
451 StringPrintf("%s=\"%s\"", | 451 StringPrintf("%s=\"%s\"", |
452 OAuthRequestSigner::Encode(param->first).c_str(), | 452 OAuthRequestSigner::Encode(param->first).c_str(), |
453 OAuthRequestSigner::Encode(param->second).c_str()); | 453 OAuthRequestSigner::Encode(param->second).c_str()); |
454 } | 454 } |
455 *signed_text_return = signed_text; | 455 *signed_text_return = signed_text; |
456 } | 456 } |
457 return is_signed; | 457 return is_signed; |
458 } | 458 } |
OLD | NEW |