• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 //
3 // Copyright 2018 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_CORE_LIB_SECURITY_SECURITY_CONNECTOR_ALTS_ALTS_SECURITY_CONNECTOR_H
20 #define GRPC_SRC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_ALTS_ALTS_SECURITY_CONNECTOR_H
21 #include <grpc/credentials.h>
22 #include <grpc/grpc.h>
23 #include <grpc/grpc_security.h>
24 #include <grpc/support/port_platform.h>
25 
26 #include "src/core/lib/security/security_connector/security_connector.h"
27 #include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
28 #include "src/core/tsi/transport_security_interface.h"
29 #include "src/core/util/ref_counted_ptr.h"
30 
31 #define GRPC_ALTS_TRANSPORT_SECURITY_TYPE "alts"
32 
33 ///
34 /// This method creates an ALTS channel security connector.
35 ///
36 ///- channel_creds: channel credential instance.
37 ///- request_metadata_creds: credential object which will be sent with each
38 ///  request. This parameter can be nullptr.
39 ///- target_name: the name of the endpoint that the channel is connecting to.
40 ///- sc: address of ALTS channel security connector instance to be returned from
41 ///  the method.
42 ///
43 /// It returns nullptr on failure.
44 ///
45 grpc_core::RefCountedPtr<grpc_channel_security_connector>
46 grpc_alts_channel_security_connector_create(
47     grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
48     grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
49     const char* target_name);
50 
51 ///
52 /// This method creates an ALTS server security connector.
53 ///
54 ///- server_creds: server credential instance.
55 ///- sc: address of ALTS server security connector instance to be returned from
56 ///  the method.
57 ///
58 /// It returns nullptr on failure.
59 ///
60 grpc_core::RefCountedPtr<grpc_server_security_connector>
61 grpc_alts_server_security_connector_create(
62     grpc_core::RefCountedPtr<grpc_server_credentials> server_creds);
63 
64 // Initializes rpc_versions.
65 void grpc_alts_set_rpc_protocol_versions(
66     grpc_gcp_rpc_protocol_versions* rpc_versions);
67 
68 namespace grpc_core {
69 namespace internal {
70 
71 // Exposed only for testing.
72 RefCountedPtr<grpc_auth_context> grpc_alts_auth_context_from_tsi_peer(
73     const tsi_peer* peer);
74 
75 }  // namespace internal
76 }  // namespace grpc_core
77 
78 #endif  // GRPC_SRC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_ALTS_ALTS_SECURITY_CONNECTOR_H
79