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_GOOGLE_MESH_CA_CERTIFICATE_PROVIDER_FACTORY_H
20 #define GRPC_CORE_EXT_XDS_GOOGLE_MESH_CA_CERTIFICATE_PROVIDER_FACTORY_H
22 #include <grpc/support/port_platform.h>
24 #include "src/core/ext/xds/certificate_provider_factory.h"
25 #include "src/core/lib/backoff/backoff.h"
26 #include "src/core/lib/gprpp/ref_counted.h"
30 class GoogleMeshCaCertificateProviderFactory
31 : public CertificateProviderFactory {
33 class Config : public CertificateProviderFactory::Config {
36 std::string token_exchange_service_uri;
40 std::string requested_token_type;
41 std::string subject_token_path;
42 std::string subject_token_type;
43 std::string actor_token_path;
44 std::string actor_token_type;
47 const char* name() const override;
49 std::string ToString() const override;
51 const std::string& endpoint() const { return endpoint_; }
53 const StsConfig& sts_config() const { return sts_config_; }
55 grpc_millis timeout() const { return timeout_; }
57 grpc_millis certificate_lifetime() const { return certificate_lifetime_; }
59 grpc_millis renewal_grace_period() const { return renewal_grace_period_; }
61 uint32_t key_size() const { return key_size_; }
63 const std::string& location() const { return location_; }
65 static RefCountedPtr<Config> Parse(const Json& config_json,
69 // Helpers for parsing the config
70 std::vector<grpc_error*> ParseJsonObjectStsService(
71 const Json::Object& sts_service);
72 std::vector<grpc_error*> ParseJsonObjectCallCredentials(
73 const Json::Object& call_credentials);
74 std::vector<grpc_error*> ParseJsonObjectGoogleGrpc(
75 const Json::Object& google_grpc);
76 std::vector<grpc_error*> ParseJsonObjectGrpcServices(
77 const Json::Object& grpc_service);
78 std::vector<grpc_error*> ParseJsonObjectServer(const Json::Object& server);
80 std::string endpoint_;
81 StsConfig sts_config_;
83 grpc_millis certificate_lifetime_;
84 grpc_millis renewal_grace_period_;
86 std::string location_;
89 const char* name() const override;
91 RefCountedPtr<CertificateProviderFactory::Config>
92 CreateCertificateProviderConfig(const Json& config_json,
93 grpc_error** error) override;
95 RefCountedPtr<grpc_tls_certificate_provider> CreateCertificateProvider(
96 RefCountedPtr<CertificateProviderFactory::Config> config) override {
97 // TODO(yashykt) : To be implemented
102 } // namespace grpc_core
104 #endif // GRPC_CORE_EXT_XDS_GOOGLE_MESH_CA_CERTIFICATE_PROVIDER_FACTORY_H