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_BASE_SSL_CLIENT_AUTH_CACHE_H_ | 5 #ifndef NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ |
6 #define NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ | 6 #define NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "net/base/cert_database.h" | 13 #include "net/base/cert_database.h" |
| 14 #include "net/base/net_api.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 class X509Certificate; | 18 class X509Certificate; |
18 | 19 |
19 // The SSLClientAuthCache class is a simple cache structure to store SSL | 20 // The SSLClientAuthCache class is a simple cache structure to store SSL |
20 // client certificates. Provides lookup, insertion, and deletion of entries. | 21 // client certificates. Provides lookup, insertion, and deletion of entries. |
21 // The parameter for doing lookups, insertions, and deletions is the server's | 22 // The parameter for doing lookups, insertions, and deletions is the server's |
22 // host and port. | 23 // host and port. |
23 // | 24 // |
24 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common | 25 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common |
25 // code to a template class. | 26 // code to a template class. |
26 class SSLClientAuthCache : public CertDatabase::Observer { | 27 class NET_TEST SSLClientAuthCache : public CertDatabase::Observer { |
27 public: | 28 public: |
28 SSLClientAuthCache(); | 29 SSLClientAuthCache(); |
29 ~SSLClientAuthCache(); | 30 ~SSLClientAuthCache(); |
30 | 31 |
31 // Checks for a client certificate preference for SSL server at |server|. | 32 // Checks for a client certificate preference for SSL server at |server|. |
32 // Returns true if a preference is found, and sets |*certificate| to the | 33 // Returns true if a preference is found, and sets |*certificate| to the |
33 // desired client certificate. The desired certificate may be NULL, which | 34 // desired client certificate. The desired certificate may be NULL, which |
34 // indicates a preference to not send any certificate to |server|. | 35 // indicates a preference to not send any certificate to |server|. |
35 // If a certificate preference is not found, returns false. | 36 // If a certificate preference is not found, returns false. |
36 bool Lookup(const std::string& server, | 37 bool Lookup(const std::string& server, |
(...skipping 16 matching lines...) Expand all Loading... |
53 typedef scoped_refptr<X509Certificate> AuthCacheValue; | 54 typedef scoped_refptr<X509Certificate> AuthCacheValue; |
54 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; | 55 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; |
55 | 56 |
56 // internal representation of cache, an STL map. | 57 // internal representation of cache, an STL map. |
57 AuthCacheMap cache_; | 58 AuthCacheMap cache_; |
58 }; | 59 }; |
59 | 60 |
60 } // namespace net | 61 } // namespace net |
61 | 62 |
62 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ | 63 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ |
OLD | NEW |