GRPC Core  9.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 
27 
28 /* -- Composite channel credentials. -- */
29 
31  public:
35  : grpc_channel_credentials(channel_creds->type()),
36  inner_creds_(std::move(channel_creds)),
37  call_creds_(std::move(call_creds)) {}
38 
39  ~grpc_composite_channel_credentials() override = default;
40 
43  return inner_creds_;
44  }
45 
49  const char* target, const grpc_channel_args* args,
50  grpc_channel_args** new_args) override;
51 
53  return inner_creds_->update_arguments(args);
54  }
55 
57  return inner_creds_.get();
58  }
59  const grpc_call_credentials* call_creds() const { return call_creds_.get(); }
60  grpc_call_credentials* mutable_call_creds() { return call_creds_.get(); }
61 
62  private:
65 };
66 
67 /* -- Composite call credentials. -- */
68 
70  public:
71  using CallCredentialsList =
73  2>;
74 
78  ~grpc_composite_call_credentials() override = default;
79 
83  grpc_closure* on_request_metadata,
84  grpc_error** error) override;
85 
87  grpc_error* error) override;
88 
89  const CallCredentialsList& inner() const { return inner_; }
90 
91  private:
92  void push_to_inner(grpc_core::RefCountedPtr<grpc_call_credentials> creds,
93  bool is_composite);
94 
95  CallCredentialsList inner_;
96 };
97 
98 #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
99  */
Definition: credentials.h:205
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: credentials.h:99
const char * type() const
Definition: credentials.h:147
Definition: error_internal.h:39
grpc_channel_args * update_arguments(grpc_channel_args *args) override
Definition: composite_credentials.h:52
Definition: credentials.h:225
~grpc_composite_call_credentials() override=default
Definition: polling_entity.h:37
grpc_composite_call_credentials(grpc_core::RefCountedPtr< grpc_call_credentials > creds1, grpc_core::RefCountedPtr< grpc_call_credentials > creds2)
Definition: composite_credentials.cc:141
const grpc_channel_credentials * inner_creds() const
Definition: composite_credentials.h:56
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:182
const grpc_call_credentials * call_creds() const
Definition: composite_credentials.h:59
grpc_core::RefCountedPtr< grpc_channel_credentials > duplicate_without_call_credentials() override
Definition: composite_credentials.h:42
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 **error) override
Definition: composite_credentials.cc:88
T * get() const
Definition: ref_counted_ptr.h:144
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
~grpc_composite_channel_credentials() override=default
void cancel_get_request_metadata(grpc_credentials_mdelem_array *md_array, grpc_error *error) override
Definition: composite_credentials.cc:111
grpc_call_credentials * mutable_call_creds()
Definition: composite_credentials.h:60
virtual grpc_channel_args * update_arguments(grpc_channel_args *args)
Definition: credentials.h:128
const CallCredentialsList & inner() const
Definition: composite_credentials.h:89
grpc_composite_channel_credentials(grpc_core::RefCountedPtr< grpc_channel_credentials > channel_creds, grpc_core::RefCountedPtr< grpc_call_credentials > call_creds)
Definition: composite_credentials.h:32
Definition: composite_credentials.h:30
Definition: composite_credentials.h:69
Context that can be used by metadata credentials plugin in order to create auth related metadata...
Definition: grpc_security.h:373
grpc_core::InlinedVector< grpc_core::RefCountedPtr< grpc_call_credentials >, 2 > CallCredentialsList
Definition: composite_credentials.h:73