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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // A NonceGenerator is a simple interface for generating client nonces. | 22 // A NonceGenerator is a simple interface for generating client nonces. |
23 // Unit tests can override the default client nonce behavior with fixed | 23 // Unit tests can override the default client nonce behavior with fixed |
24 // nonce generation to get reproducible results. | 24 // nonce generation to get reproducible results. |
25 class NET_EXPORT_PRIVATE NonceGenerator { | 25 class NET_EXPORT_PRIVATE NonceGenerator { |
26 public: | 26 public: |
27 NonceGenerator(); | 27 NonceGenerator(); |
28 virtual ~NonceGenerator(); | 28 virtual ~NonceGenerator(); |
29 | 29 |
30 // Generates a client nonce. | 30 // Generates a client nonce. |
31 virtual std::string GenerateNonce() const = 0; | 31 virtual std::string GenerateNonce() const = 0; |
| 32 |
32 private: | 33 private: |
33 DISALLOW_COPY_AND_ASSIGN(NonceGenerator); | 34 DISALLOW_COPY_AND_ASSIGN(NonceGenerator); |
34 }; | 35 }; |
35 | 36 |
36 // DynamicNonceGenerator does a random shuffle of 16 | 37 // DynamicNonceGenerator does a random shuffle of 16 |
37 // characters to generate a client nonce. | 38 // characters to generate a client nonce. |
38 class DynamicNonceGenerator : public NonceGenerator { | 39 class DynamicNonceGenerator : public NonceGenerator { |
39 public: | 40 public: |
40 DynamicNonceGenerator(); | 41 DynamicNonceGenerator(); |
41 virtual std::string GenerateNonce() const OVERRIDE; | 42 virtual std::string GenerateNonce() const OVERRIDE; |
| 43 |
42 private: | 44 private: |
43 DISALLOW_COPY_AND_ASSIGN(DynamicNonceGenerator); | 45 DISALLOW_COPY_AND_ASSIGN(DynamicNonceGenerator); |
44 }; | 46 }; |
45 | 47 |
46 // FixedNonceGenerator always uses the same string specified at | 48 // FixedNonceGenerator always uses the same string specified at |
47 // construction time as the client nonce. | 49 // construction time as the client nonce. |
48 class NET_EXPORT_PRIVATE FixedNonceGenerator : public NonceGenerator { | 50 class NET_EXPORT_PRIVATE FixedNonceGenerator : public NonceGenerator { |
49 public: | 51 public: |
50 explicit FixedNonceGenerator(const std::string& nonce); | 52 explicit FixedNonceGenerator(const std::string& nonce); |
51 | 53 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // UTF-8. | 172 // UTF-8. |
171 std::string original_realm_; | 173 std::string original_realm_; |
172 | 174 |
173 int nonce_count_; | 175 int nonce_count_; |
174 const NonceGenerator* nonce_generator_; | 176 const NonceGenerator* nonce_generator_; |
175 }; | 177 }; |
176 | 178 |
177 } // namespace net | 179 } // namespace net |
178 | 180 |
179 #endif // NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ | 181 #endif // NET_HTTP_HTTP_AUTH_HANDLER_DIGEST_H_ |
OLD | NEW |