3 // Copyright 2020 gRPC authors.
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #ifndef GRPC_CORE_EXT_XDS_XDS_CERTIFICATE_PROVIDER_H
20 #define GRPC_CORE_EXT_XDS_XDS_CERTIFICATE_PROVIDER_H
22 #include <grpc/support/port_platform.h>
24 #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
28 class XdsCertificateProvider : public grpc_tls_certificate_provider {
30 XdsCertificateProvider(
31 absl::string_view root_cert_name,
32 RefCountedPtr<grpc_tls_certificate_distributor> root_cert_distributor,
33 absl::string_view identity_cert_name,
34 RefCountedPtr<grpc_tls_certificate_distributor>
35 identity_cert_distributor);
37 void UpdateRootCertNameAndDistributor(
38 absl::string_view root_cert_name,
39 RefCountedPtr<grpc_tls_certificate_distributor> root_cert_distributor);
40 void UpdateIdentityCertNameAndDistributor(
41 absl::string_view identity_cert_name,
42 RefCountedPtr<grpc_tls_certificate_distributor>
43 identity_cert_distributor);
45 grpc_core::RefCountedPtr<grpc_tls_certificate_distributor> distributor()
51 void WatchStatusCallback(std::string cert_name, bool root_being_watched,
52 bool identity_being_watched);
53 void UpdateRootCertWatcher(
54 grpc_tls_certificate_distributor* root_cert_distributor);
55 void UpdateIdentityCertWatcher(
56 grpc_tls_certificate_distributor* identity_cert_distributor);
59 bool watching_root_certs_ = false;
60 bool watching_identity_certs_ = false;
61 std::string root_cert_name_;
62 std::string identity_cert_name_;
63 RefCountedPtr<grpc_tls_certificate_distributor> root_cert_distributor_;
64 RefCountedPtr<grpc_tls_certificate_distributor> identity_cert_distributor_;
65 RefCountedPtr<grpc_tls_certificate_distributor> distributor_;
66 grpc_tls_certificate_distributor::TlsCertificatesWatcherInterface*
67 root_cert_watcher_ = nullptr;
68 grpc_tls_certificate_distributor::TlsCertificatesWatcherInterface*
69 identity_cert_watcher_ = nullptr;
72 } // namespace grpc_core
74 #endif // GRPC_CORE_EXT_XDS_XDS_CERTIFICATE_PROVIDER_H