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

Side by Side Diff: net/http/http_mac_signature.h

Issue 6969050: MAC Cookies (patch 4 of N) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth.cc ('k') | net/http/http_mac_signature.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_HTTP_MAC_SIGNATURE_H_ 5 #ifndef NET_HTTP_MAC_SIGNATURE_H_
6 #define NET_HTTP_MAC_SIGNATURE_H_ 6 #define NET_HTTP_MAC_SIGNATURE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 10 matching lines...) Expand all
21 // http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token 21 // http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token
22 // 22 //
23 class HttpMacSignature { 23 class HttpMacSignature {
24 public: 24 public:
25 HttpMacSignature(); 25 HttpMacSignature();
26 ~HttpMacSignature(); 26 ~HttpMacSignature();
27 27
28 // Returns whether this information is valid. 28 // Returns whether this information is valid.
29 bool AddStateInfo(const std::string& id, 29 bool AddStateInfo(const std::string& id,
30 const std::string& mac_key, 30 const std::string& mac_key,
31 const std::string& mac_algorithm, 31 const std::string& mac_algorithm);
32 const std::string& issuer);
33 32
34 // Returns whether this information is valid. 33 // Returns whether this information is valid.
35 bool AddHttpInfo(const std::string& method, 34 bool AddHttpInfo(const std::string& method,
36 const std::string& request_uri, 35 const std::string& request_uri,
37 const std::string& host, 36 const std::string& host,
38 int port); 37 int port);
39 38
40 // Returns the value of the Authorization header for use in an HTTP request. 39 // Returns the value of the Authorization header for use in an HTTP request.
41 std::string GenerateAuthorizationHeader(); 40 std::string GenerateAuthorizationHeader();
42 41
43 private: 42 private:
44 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateHeaderString); 43 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateHeaderString);
45 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateNormalizedRequest); 44 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateNormalizedRequest);
46 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateMAC); 45 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateMAC);
47 46
48 std::string GenerateHeaderString(const std::string& timestamp, 47 std::string GenerateHeaderString(const std::string& timestamp,
49 const std::string& nonce); 48 const std::string& nonce);
50 std::string GenerateNormalizedRequest(const std::string& timestamp, 49 std::string GenerateNormalizedRequest(const std::string& timestamp,
51 const std::string& nonce); 50 const std::string& nonce);
52 std::string GenerateMAC(const std::string& timestamp, 51 std::string GenerateMAC(const std::string& timestamp,
53 const std::string& nonce); 52 const std::string& nonce);
54 53
55 std::string id_; 54 std::string id_;
56 std::string mac_key_; 55 std::string mac_key_;
57 crypto::HMAC::HashAlgorithm mac_algorithm_; 56 crypto::HMAC::HashAlgorithm mac_algorithm_;
58 std::string issuer_;
59 57
60 std::string method_; 58 std::string method_;
61 std::string request_uri_; 59 std::string request_uri_;
62 std::string host_; 60 std::string host_;
63 std::string port_; 61 std::string port_;
64 // TODO(abarth): body_hash_ 62 // TODO(abarth): body_hash_
65 63
66 DISALLOW_COPY_AND_ASSIGN(HttpMacSignature); 64 DISALLOW_COPY_AND_ASSIGN(HttpMacSignature);
67 }; 65 };
68 66
69 } // namespace net 67 } // namespace net
70 68
71 #endif // NET_HTTP_MAC_SIGNATURE_H_ 69 #endif // NET_HTTP_MAC_SIGNATURE_H_
OLDNEW
« no previous file with comments | « net/http/http_auth.cc ('k') | net/http/http_mac_signature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698