OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SSL_CLIENT_CERT_STORE_MAC_H_ | 5 #ifndef NET_SSL_CLIENT_CERT_STORE_MAC_H_ |
6 #define NET_SSL_CLIENT_CERT_STORE_MAC_H_ | 6 #define NET_SSL_CLIENT_CERT_STORE_MAC_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/ssl/client_cert_store.h" | 11 #include "net/ssl/client_cert_store.h" |
12 #include "net/ssl/ssl_cert_request_info.h" | 12 #include "net/ssl/ssl_cert_request_info.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class NET_EXPORT ClientCertStoreMac : public ClientCertStore { | 16 class NET_EXPORT ClientCertStoreMac : public ClientCertStore { |
17 public: | 17 public: |
18 ClientCertStoreMac(); | 18 ClientCertStoreMac(); |
19 ~ClientCertStoreMac() override; | 19 ~ClientCertStoreMac() override; |
20 | 20 |
21 // ClientCertStore: | 21 // ClientCertStore: |
22 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, | 22 void GetClientCerts(const SSLCertRequestInfo& cert_request_info, |
23 const ClientCertListCallback& callback) override; | 23 const ClientCertListCallback& callback) override; |
24 | 24 |
25 private: | 25 private: |
26 friend class ClientCertStoreMacTest; | 26 friend class ClientCertStoreMacTest; |
27 friend class ClientCertStoreMacTestDelegate; | 27 friend class ClientCertStoreMacTestDelegate; |
28 | 28 |
29 // A hook for testing. Filters |input_certs| using the logic being used to | 29 // A hook for testing. Filters |input_identities| using the logic being used |
30 // filter the system store when GetClientCerts() is called. | 30 // to filter the system store when GetClientCerts() is called. Implemented by |
31 // Implemented by creating a list of certificates that otherwise would be | 31 // creating a list of certificates that otherwise would be extracted from the |
32 // extracted from the system store and filtering it using the common logic | 32 // system store and filtering it using the common logic (less adequate than |
33 // (less adequate than the approach used on Windows). | 33 // the approach used on Windows). |
34 bool SelectClientCertsForTesting(const CertificateList& input_certs, | 34 bool SelectClientCertsForTesting(ClientCertIdentityList input_identities, |
35 const SSLCertRequestInfo& cert_request_info, | 35 const SSLCertRequestInfo& cert_request_info, |
36 CertificateList* selected_certs); | 36 ClientCertIdentityList* selected_identities); |
37 | 37 |
38 // Testing hook specific to Mac, where the internal logic recognizes preferred | 38 // Testing hook specific to Mac, where the internal logic recognizes preferred |
39 // certificates for particular domains. If the preferred certificate is | 39 // certificates for particular domains. If the preferred certificate is |
40 // present in the output list (i.e. it doesn't get filtered out), it should | 40 // present in the output list (i.e. it doesn't get filtered out), it should |
41 // always come first. | 41 // always come first. |
42 bool SelectClientCertsGivenPreferredForTesting( | 42 bool SelectClientCertsGivenPreferredForTesting( |
43 const scoped_refptr<X509Certificate>& preferred_cert, | 43 std::unique_ptr<ClientCertIdentity> preferred_identity, |
44 const CertificateList& regular_certs, | 44 ClientCertIdentityList regular_identities, |
45 const SSLCertRequestInfo& request, | 45 const SSLCertRequestInfo& request, |
46 CertificateList* selected_certs); | 46 ClientCertIdentityList* selected_identities); |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreMac); | 48 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreMac); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace net | 51 } // namespace net |
52 | 52 |
53 #endif // NET_SSL_CLIENT_CERT_STORE_MAC_H_ | 53 #endif // NET_SSL_CLIENT_CERT_STORE_MAC_H_ |
OLD | NEW |