GRPC Core  18.0.0
insecure_security_connector.h
Go to the documentation of this file.
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_LIB_SECURITY_SECURITY_CONNECTOR_INSECURE_INSECURE_SECURITY_CONNECTOR_H
20 #define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_INSECURE_INSECURE_SECURITY_CONNECTOR_H
21 
23 
27 
28 namespace grpc_core {
29 
30 extern const char kInsecureTransportSecurityType[];
31 
32 // Exposed for testing purposes only.
33 // Create an auth context which is necessary to pass the santiy check in
34 // client_auth_filter that verifies if the peer's auth context is obtained
35 // during handshakes.
36 RefCountedPtr<grpc_auth_context> TestOnlyMakeInsecureAuthContext();
37 
40  public:
44  : grpc_channel_security_connector(/* url_scheme */ nullptr,
45  std::move(channel_creds),
46  std::move(request_metadata_creds)) {}
47 
48  bool check_call_host(absl::string_view host, grpc_auth_context* auth_context,
49  grpc_closure* on_call_host_checked,
50  grpc_error_handle* error) override;
51 
52  void cancel_check_call_host(grpc_closure* on_call_host_checked,
53  grpc_error_handle error) override;
54 
55  void add_handshakers(const grpc_channel_args* args,
56  grpc_pollset_set* /* interested_parties */,
57  grpc_core::HandshakeManager* handshake_manager) override;
58 
59  void check_peer(tsi_peer peer, grpc_endpoint* ep,
61  grpc_closure* on_peer_checked) override;
62 
63  void cancel_check_peer(grpc_closure* /*on_peer_checked*/,
64  grpc_error_handle error) override {
66  }
67 
68  int cmp(const grpc_security_connector* other_sc) const override;
69 };
70 
72  public:
75  : grpc_server_security_connector(nullptr /* url_scheme */,
76  std::move(server_creds)) {}
77 
78  void add_handshakers(const grpc_channel_args* args,
79  grpc_pollset_set* /* interested_parties */,
80  grpc_core::HandshakeManager* handshake_manager) override;
81 
82  void check_peer(tsi_peer peer, grpc_endpoint* ep,
84  grpc_closure* on_peer_checked) override;
85 
86  void cancel_check_peer(grpc_closure* /*on_peer_checked*/,
87  grpc_error_handle error) override {
89  }
90 
91  int cmp(const grpc_security_connector* other) const override;
92 };
93 
94 } // namespace grpc_core
95 
96 #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_INSECURE_INSECURE_SECURITY_CONNECTOR_H \
97  */
Definition: security_connector.h:94
const grpc_call_credentials * request_metadata_creds() const
Definition: security_connector.h:128
const grpc_channel_credentials * channel_creds() const
Definition: security_connector.h:122
Definition: handshaker.h:92
Definition: insecure_security_connector.h:39
InsecureChannelSecurityConnector(grpc_core::RefCountedPtr< grpc_channel_credentials > channel_creds, grpc_core::RefCountedPtr< grpc_call_credentials > request_metadata_creds)
Definition: insecure_security_connector.h:41
void cancel_check_call_host(grpc_closure *on_call_host_checked, grpc_error_handle error) override
Cancels a pending asynchronous call to grpc_channel_security_connector_check_call_host() with on_call...
Definition: insecure_security_connector.cc:60
void check_peer(tsi_peer peer, grpc_endpoint *ep, grpc_core::RefCountedPtr< grpc_auth_context > *auth_context, grpc_closure *on_peer_checked) override
Definition: insecure_security_connector.cc:78
int cmp(const grpc_security_connector *other_sc) const override
Definition: insecure_security_connector.cc:87
void cancel_check_peer(grpc_closure *, grpc_error_handle error) override
Definition: insecure_security_connector.h:63
void add_handshakers(const grpc_channel_args *args, grpc_pollset_set *, grpc_core::HandshakeManager *handshake_manager) override
Registers handshakers with handshake_mgr.
Definition: insecure_security_connector.cc:68
bool check_call_host(absl::string_view host, grpc_auth_context *auth_context, grpc_closure *on_call_host_checked, grpc_error_handle *error) override
Checks that the host that will be set for a call is acceptable.
Definition: insecure_security_connector.cc:53
Definition: insecure_security_connector.h:71
void check_peer(tsi_peer peer, grpc_endpoint *ep, grpc_core::RefCountedPtr< grpc_auth_context > *auth_context, grpc_closure *on_peer_checked) override
Definition: insecure_security_connector.cc:106
InsecureServerSecurityConnector(grpc_core::RefCountedPtr< grpc_server_credentials > server_creds)
Definition: insecure_security_connector.h:73
void add_handshakers(const grpc_channel_args *args, grpc_pollset_set *, grpc_core::HandshakeManager *handshake_manager) override
Definition: insecure_security_connector.cc:96
void cancel_check_peer(grpc_closure *, grpc_error_handle error) override
Definition: insecure_security_connector.h:86
int cmp(const grpc_security_connector *other) const override
Definition: insecure_security_connector.cc:115
Definition: security_connector.h:48
Definition: security_connector.h:156
const grpc_server_credentials * server_creds() const
Definition: security_connector.h:167
#define GRPC_ERROR_UNREF(err)
Definition: error.h:254
grpc_error_handle error
Definition: lame_client.cc:54
Round Robin Policy.
Definition: backend_metric.cc:26
RefCountedPtr< grpc_auth_context > TestOnlyMakeInsecureAuthContext()
Definition: insecure_security_connector.cc:47
const char kInsecureTransportSecurityType[]
Definition: insecure_security_connector.cc:29
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
Definition: security_context.h:51
An array of arguments that can be passed around.
Definition: grpc_types.h:132
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: endpoint.h:106
Definition: error_internal.h:41
Definition: transport_security_interface.h:216