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

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

Issue 9700056: Remove experimental support for MAC cookies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused global Created 8 years, 9 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 | « chrome/common/chrome_switches.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP_MAC_SIGNATURE_H_
6 #define NET_HTTP_MAC_SIGNATURE_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/time.h"
14 #include "crypto/hmac.h"
15 #include "net/base/net_export.h"
16
17 namespace net {
18
19 // This class represents an HTTP MAC signature for use in the HTTP MAC
20 // Authentication scheme. The current draft specification of this
21 // authentication scheme is located at the following URL:
22 //
23 // http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token
24 //
25 class NET_EXPORT_PRIVATE HttpMacSignature {
26 public:
27 HttpMacSignature();
28 ~HttpMacSignature();
29
30 // Returns whether this information is valid.
31 bool AddStateInfo(const std::string& id,
32 const base::Time& creation_date,
33 const std::string& mac_key,
34 const std::string& mac_algorithm);
35
36 // Returns whether this information is valid.
37 bool AddHttpInfo(const std::string& method,
38 const std::string& request_uri,
39 const std::string& host,
40 int port);
41
42 // Generates the Authorization header for use in an HTTP request. If
43 // successfully generated, returns true and stores the resultant header in
44 // |*header|.
45 bool GenerateAuthorizationHeader(std::string* header);
46
47 private:
48 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateHeaderString);
49 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateNormalizedRequest);
50 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateMAC);
51
52 bool GenerateHeaderString(const std::string& age,
53 const std::string& nonce,
54 std::string* header);
55 std::string GenerateNormalizedRequest(const std::string& age,
56 const std::string& nonce);
57 bool GenerateMAC(const std::string& age,
58 const std::string& nonce,
59 std::string* mac);
60
61 std::string id_;
62 base::Time creation_date_;
63 std::string mac_key_;
64 crypto::HMAC::HashAlgorithm mac_algorithm_;
65
66 std::string method_;
67 std::string request_uri_;
68 std::string host_;
69 std::string port_;
70 // TODO(abarth): body_hash_
71
72 DISALLOW_COPY_AND_ASSIGN(HttpMacSignature);
73 };
74
75 } // namespace net
76
77 #endif // NET_HTTP_MAC_SIGNATURE_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | net/http/http_mac_signature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698