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_LIB_SECURITY_CREDENTIALS_XDS_XDS_CREDENTIALS_H
20 #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_XDS_XDS_CREDENTIALS_H
22 #include <grpc/support/port_platform.h>
24 #include <grpc/grpc_security.h>
26 #include "src/core/ext/xds/xds_api.h"
27 #include "src/core/lib/security/credentials/credentials.h"
31 extern const char kCredentialsTypeXds[];
33 class XdsCredentials final : public grpc_channel_credentials {
35 explicit XdsCredentials(
36 RefCountedPtr<grpc_channel_credentials> fallback_credentials)
37 : grpc_channel_credentials(kCredentialsTypeXds),
38 fallback_credentials_(std::move(fallback_credentials)) {}
40 RefCountedPtr<grpc_channel_security_connector> create_security_connector(
41 RefCountedPtr<grpc_call_credentials> call_creds, const char* target_name,
42 const grpc_channel_args* args, grpc_channel_args** new_args) override;
45 RefCountedPtr<grpc_channel_credentials> fallback_credentials_;
48 class XdsServerCredentials final : public grpc_server_credentials {
50 explicit XdsServerCredentials(
51 RefCountedPtr<grpc_server_credentials> fallback_credentials)
52 : grpc_server_credentials(kCredentialsTypeXds),
53 fallback_credentials_(std::move(fallback_credentials)) {}
55 RefCountedPtr<grpc_server_security_connector> create_security_connector(
56 const grpc_channel_args* /* args */) override;
59 RefCountedPtr<grpc_server_credentials> fallback_credentials_;
62 bool TestOnlyXdsVerifySubjectAlternativeNames(
63 const char* const* subject_alternative_names,
64 size_t subject_alternative_names_size,
65 const std::vector<StringMatcher>& matchers);
67 } // namespace grpc_core
69 #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_XDS_XDS_CREDENTIALS_H */