Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ | 5 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ |
| 6 #define CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ | 6 #define CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/network/certificate_pattern.h" | 13 #include "chromeos/network/certificate_pattern.h" |
| 14 #include "components/onc/onc_constants.h" | |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class DictionaryValue; | 17 class DictionaryValue; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 struct CertPrincipal; | 21 struct CertPrincipal; |
| 21 class X509Certificate; | 22 class X509Certificate; |
| 22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 23 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
| 23 } | 24 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 43 ConfigType location; | 44 ConfigType location; |
| 44 | 45 |
| 45 // One of the ClientCertTypes defined in ONC: kNone, kRef, or kPattern. | 46 // One of the ClientCertTypes defined in ONC: kNone, kRef, or kPattern. |
| 46 std::string client_cert_type; | 47 std::string client_cert_type; |
| 47 | 48 |
| 48 // If |client_cert_type| equals kPattern, this contains the pattern. | 49 // If |client_cert_type| equals kPattern, this contains the pattern. |
| 49 CertificatePattern pattern; | 50 CertificatePattern pattern; |
| 50 | 51 |
| 51 // The value of kIdentity, to enable substitutions. | 52 // The value of kIdentity, to enable substitutions. |
| 52 std::string policy_identity; | 53 std::string policy_identity; |
| 54 | |
| 55 // true if the source of this ClientCertConfig is device ONC. | |
| 56 bool source_is_device_policy_; | |
|
emaxx
2017/04/20 20:10:39
Maybe just including ONCSource here would be bette
emaxx
2017/04/20 20:10:39
nit: The trailing underscore is extra.
pmarko
2017/04/24 14:49:56
Done. (both - renamed to onc_source)
| |
| 53 }; | 57 }; |
| 54 | 58 |
| 55 // Returns true only if any fields set in this pattern match exactly with | 59 // Returns true only if any fields set in this pattern match exactly with |
| 56 // similar fields in the principal. If organization_ or organizational_unit_ | 60 // similar fields in the principal. If organization_ or organizational_unit_ |
| 57 // are set, then at least one of the organizations or units in the principal | 61 // are set, then at least one of the organizations or units in the principal |
| 58 // must match. | 62 // must match. |
| 59 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern, | 63 bool CertPrincipalMatches(const IssuerSubjectPattern& pattern, |
| 60 const net::CertPrincipal& principal); | 64 const net::CertPrincipal& principal); |
| 61 | 65 |
| 62 // Returns the PKCS11 and slot ID of |cert_id|, which is expected to be a | 66 // Returns the PKCS11 and slot ID of |cert_id|, which is expected to be a |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 92 CHROMEOS_EXPORT void SetEmptyShillProperties(const ConfigType cert_config_type, | 96 CHROMEOS_EXPORT void SetEmptyShillProperties(const ConfigType cert_config_type, |
| 93 base::DictionaryValue* properties); | 97 base::DictionaryValue* properties); |
| 94 | 98 |
| 95 // Returns true if all required configuration properties are set and not empty. | 99 // Returns true if all required configuration properties are set and not empty. |
| 96 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, | 100 bool IsCertificateConfigured(const client_cert::ConfigType cert_config_type, |
| 97 const base::DictionaryValue& service_properties); | 101 const base::DictionaryValue& service_properties); |
| 98 | 102 |
| 99 // Determines the type of the CertificatePattern configuration, i.e. is it a | 103 // Determines the type of the CertificatePattern configuration, i.e. is it a |
| 100 // pattern within an EAP, IPsec or OpenVPN configuration. | 104 // pattern within an EAP, IPsec or OpenVPN configuration. |
| 101 CHROMEOS_EXPORT void OncToClientCertConfig( | 105 CHROMEOS_EXPORT void OncToClientCertConfig( |
| 106 ::onc::ONCSource onc_source, | |
| 102 const base::DictionaryValue& network_config, | 107 const base::DictionaryValue& network_config, |
| 103 ClientCertConfig* cert_config); | 108 ClientCertConfig* cert_config); |
| 104 | 109 |
| 105 } // namespace client_cert | 110 } // namespace client_cert |
| 106 | 111 |
| 107 } // namespace chromeos | 112 } // namespace chromeos |
| 108 | 113 |
| 109 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ | 114 #endif // CHROMEOS_NETWORK_CLIENT_CERT_UTIL_H_ |
| OLD | NEW |