xref: /aosp_15_r20/external/grpc-grpc/src/cpp/client/secure_credentials.h (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 //
2 //
3 // Copyright 2015 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_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
20 #define GRPC_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
21 
22 #include <grpc/grpc.h>
23 #include <grpc/grpc_security.h>
24 #include <grpc/status.h>
25 #include <grpcpp/channel.h>
26 #include <grpcpp/impl/grpc_library.h>
27 #include <grpcpp/security/credentials.h>
28 #include <grpcpp/support/channel_arguments.h>
29 #include <grpcpp/support/client_interceptor.h>
30 
31 namespace grpc {
32 
33 namespace experimental {
34 
35 // Transforms C++ STS Credentials options to core options. The pointers of the
36 // resulting core options point to the memory held by the C++ options so C++
37 // options need to be kept alive until after the core credentials creation.
38 grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
39     const StsCredentialsOptions& options);
40 
41 }  // namespace experimental
42 
43 /// ---- DEPRECATED ----
44 /// This type is going away. Prefer creating a subclass of
45 /// grpc::ChannelCredentials.
46 class SecureChannelCredentials final : public grpc::ChannelCredentials {
47  public:
SecureChannelCredentials(grpc_channel_credentials * c_creds)48   explicit SecureChannelCredentials(grpc_channel_credentials* c_creds)
49       : ChannelCredentials(c_creds) {}
50 };
51 
52 /// ---- DEPRECATED ----
53 /// This type is going away. Prefer creating a subclass of
54 /// grpc::CallCredentials.
55 class SecureCallCredentials final : public grpc::CallCredentials {
56  public:
SecureCallCredentials(grpc_call_credentials * c_creds)57   explicit SecureCallCredentials(grpc_call_credentials* c_creds)
58       : CallCredentials(c_creds) {}
59 };
60 
61 }  // namespace grpc
62 
63 #endif  // GRPC_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
64