GRPC Core  18.0.0
composite_credentials.h
Go to the documentation of this file.
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_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
20 #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
21 
23 
24 #include <string>
25 
26 #include "absl/container/inlined_vector.h"
27 
30 
31 /* -- Composite channel credentials. -- */
32 
34  public:
38  : grpc_channel_credentials(channel_creds->type()),
39  inner_creds_(std::move(channel_creds)),
40  call_creds_(std::move(call_creds)) {}
41 
43 
46  return inner_creds_;
47  }
48 
52  const char* target, const grpc_channel_args* args,
53  grpc_channel_args** new_args) override;
54 
56  return inner_creds_->update_arguments(args);
57  }
58 
60  return inner_creds_.get();
61  }
62  const grpc_call_credentials* call_creds() const { return call_creds_.get(); }
63  grpc_call_credentials* mutable_call_creds() { return call_creds_.get(); }
64 
65  private:
68 };
69 
70 /* -- Composite call credentials. -- */
71 
73  public:
75  absl::InlinedVector<grpc_core::RefCountedPtr<grpc_call_credentials>, 2>;
76 
80  ~grpc_composite_call_credentials() override = default;
81 
85  grpc_closure* on_request_metadata,
86  grpc_error_handle* error) override;
87 
89  grpc_error_handle error) override;
90 
92  return min_security_level_;
93  }
94 
95  const CallCredentialsList& inner() const { return inner_; }
96  std::string debug_string() override;
97 
98  private:
99  void push_to_inner(grpc_core::RefCountedPtr<grpc_call_credentials> creds,
100  bool is_composite);
101  grpc_security_level min_security_level_;
102  CallCredentialsList inner_;
103 };
104 
105 #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
106  */
Definition: composite_credentials.h:72
grpc_composite_call_credentials(grpc_core::RefCountedPtr< grpc_call_credentials > creds1, grpc_core::RefCountedPtr< grpc_call_credentials > creds2)
Definition: composite_credentials.cc:153
std::string debug_string() override
Definition: composite_credentials.cc:122
~grpc_composite_call_credentials() override=default
grpc_security_level min_security_level() const override
Definition: composite_credentials.h:91
bool get_request_metadata(grpc_polling_entity *pollent, grpc_auth_metadata_context context, grpc_credentials_mdelem_array *md_array, grpc_closure *on_request_metadata, grpc_error_handle *error) override
Definition: composite_credentials.cc:91
void cancel_get_request_metadata(grpc_credentials_mdelem_array *md_array, grpc_error_handle error) override
Definition: composite_credentials.cc:114
const CallCredentialsList & inner() const
Definition: composite_credentials.h:95
absl::InlinedVector< grpc_core::RefCountedPtr< grpc_call_credentials >, 2 > CallCredentialsList
Definition: composite_credentials.h:75
Definition: composite_credentials.h:33
grpc_core::RefCountedPtr< grpc_channel_credentials > duplicate_without_call_credentials() override
Definition: composite_credentials.h:45
grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args) override
Definition: composite_credentials.cc:201
grpc_call_credentials * mutable_call_creds()
Definition: composite_credentials.h:63
~grpc_composite_channel_credentials() override=default
grpc_composite_channel_credentials(grpc_core::RefCountedPtr< grpc_channel_credentials > channel_creds, grpc_core::RefCountedPtr< grpc_call_credentials > call_creds)
Definition: composite_credentials.h:35
const grpc_call_credentials * call_creds() const
Definition: composite_credentials.h:62
const grpc_channel_credentials * inner_creds() const
Definition: composite_credentials.h:59
grpc_channel_args * update_arguments(grpc_channel_args *args) override
Definition: composite_credentials.h:55
T * get() const
Definition: ref_counted_ptr.h:147
grpc_security_level
Definition: grpc_security_constants.h:129
grpc_error_handle error
Definition: lame_client.cc:54
Context that can be used by metadata credentials plugin in order to create auth related metadata.
Definition: grpc_security.h:402
Definition: credentials.h:173
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: credentials.h:102
const char * type() const
Definition: credentials.h:134
virtual grpc_channel_args * update_arguments(grpc_channel_args *args)
Definition: credentials.h:130
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: credentials.h:153
Definition: error_internal.h:41
Definition: polling_entity.h:37