1 // 2 // 3 // Copyright 2020 gRPC authors. 4 // 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 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 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. 16 // 17 // 18 19 #ifndef GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H 20 #define GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H 21 22 #include <grpc/support/port_platform.h> 23 24 #include "src/core/ext/xds/certificate_provider_factory.h" 25 26 namespace grpc_core { 27 28 class FileWatcherCertificateProviderFactory 29 : public CertificateProviderFactory { 30 public: 31 class Config : public CertificateProviderFactory::Config { 32 public: 33 static RefCountedPtr<Config> Parse(const Json& config_json, 34 grpc_error** error); 35 36 const char* name() const override; 37 38 std::string ToString() const override; 39 identity_cert_file()40 const std::string& identity_cert_file() const { 41 return identity_cert_file_; 42 } 43 private_key_file()44 const std::string& private_key_file() const { return private_key_file_; } 45 root_cert_file()46 const std::string& root_cert_file() const { return root_cert_file_; } 47 refresh_interval_ms()48 grpc_millis refresh_interval_ms() const { return refresh_interval_ms_; } 49 50 private: 51 std::string identity_cert_file_; 52 std::string private_key_file_; 53 std::string root_cert_file_; 54 grpc_millis refresh_interval_ms_; 55 }; 56 57 const char* name() const override; 58 59 RefCountedPtr<CertificateProviderFactory::Config> 60 CreateCertificateProviderConfig(const Json& config_json, 61 grpc_error** error) override; 62 63 RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider( 64 RefCountedPtr<CertificateProviderFactory::Config> config) override; 65 }; 66 67 } // namespace grpc_core 68 69 #endif // GRPC_CORE_EXT_XDS_FILE_WATCHER_CERTIFICATE_PROVIDER_FACTORY_H 70