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

Side by Side Diff: net/base/ssl_client_auth_cache.h

Issue 4568002: Remember if a user declines to provide a server with a client certificate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgot about unittests Created 10 years, 1 month 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 | « no previous file | net/base/ssl_client_auth_cache.cc » ('j') | net/http/http_network_transaction.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "net/base/x509_certificate.h"
14 13
15 namespace net { 14 namespace net {
16 15
16 class X509Certificate;
17
17 // The SSLClientAuthCache class is a simple cache structure to store SSL 18 // The SSLClientAuthCache class is a simple cache structure to store SSL
18 // client certificates. Provides lookup, insertion, and deletion of entries. 19 // client certificates. Provides lookup, insertion, and deletion of entries.
19 // The parameter for doing lookups, insertions, and deletions is the server's 20 // The parameter for doing lookups, insertions, and deletions is the server's
20 // host and port. 21 // host and port.
21 // 22 //
22 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common 23 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common
23 // code to a template class. 24 // code to a template class.
24 class SSLClientAuthCache { 25 class SSLClientAuthCache {
25 public: 26 public:
26 SSLClientAuthCache(); 27 SSLClientAuthCache();
27 ~SSLClientAuthCache(); 28 ~SSLClientAuthCache();
28 29
29 // Check if we have a client certificate for SSL server at |server|. 30 // Check if we have a client certificate preference for SSL server at
30 // Returns the client certificate (if found) or NULL (if not found). 31 // |server|. Returns true if a preference is found.
31 X509Certificate* Lookup(const std::string& server); 32 // If found, |*certificate| will point to the client certificate
33 // if the user has selected a certificate, or NULL if the user has opted to
34 // not provide a certificate.
35 // If a certificate preference is not found, |*certificate| will be NULL.
wtc 2010/11/18 01:33:07 This should say: If a certificate preference is
36 bool Lookup(const std::string& server, X509Certificate** certificate);
wtc 2010/11/18 01:33:07 Declare the output argument as scoped_refptr<X50
32 37
33 // Add a client certificate for |server| to the cache. If there is already 38 // Add a client certificate for |server| to the cache. If there is already
34 // a client certificate for |server|, it will be overwritten. Both parameters 39 // a client certificate for |server|, it will be overwritten. Both parameters
35 // are IN only. 40 // are IN only.
36 void Add(const std::string& server, X509Certificate* client_cert); 41 void Add(const std::string& server, X509Certificate* client_cert);
37 42
38 // Remove the client certificate for |server| from the cache, if one exists. 43 // Remove the client certificate for |server| from the cache, if one exists.
39 void Remove(const std::string& server); 44 void Remove(const std::string& server);
40 45
41 private: 46 private:
42 typedef std::string AuthCacheKey; 47 typedef std::string AuthCacheKey;
43 typedef scoped_refptr<X509Certificate> AuthCacheValue; 48 typedef scoped_refptr<X509Certificate> AuthCacheValue;
44 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; 49 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap;
45 50
46 // internal representation of cache, an STL map. 51 // internal representation of cache, an STL map.
47 AuthCacheMap cache_; 52 AuthCacheMap cache_;
48 }; 53 };
49 54
50 } // namespace net 55 } // namespace net
51 56
52 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_ 57 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/ssl_client_auth_cache.cc » ('j') | net/http/http_network_transaction.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698