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 <algorithm>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 #include "absl/status/statusor.h"
30 
31 #include <grpc/grpc.h>
32 #include <grpc/grpc_security.h>
35 
44 
45 /* -- Composite channel credentials. -- */
46 
48  public:
52  : inner_creds_(std::move(channel_creds)),
54 
55  ~grpc_composite_channel_credentials() override = default;
56 
59  return inner_creds_;
60  }
61 
65  const char* target, const grpc_channel_args* args,
66  grpc_channel_args** new_args) override;
67 
69  grpc_core::ChannelArgs args) override {
71  }
72 
73  grpc_core::UniqueTypeName type() const override;
74 
76  return inner_creds_.get();
77  }
78  const grpc_call_credentials* call_creds() const { return call_creds_.get(); }
80 
81  private:
82  int cmp_impl(const grpc_channel_credentials* other) const override {
83  auto* o = static_cast<const grpc_composite_channel_credentials*>(other);
84  int r = inner_creds_->cmp(o->inner_creds_.get());
85  if (r != 0) return r;
86  return call_creds_->cmp(o->call_creds_.get());
87  }
88 
91 };
92 
93 /* -- Composite call credentials. -- */
94 
96  public:
97  using CallCredentialsList =
98  std::vector<grpc_core::RefCountedPtr<grpc_call_credentials>>;
99 
103  ~grpc_composite_call_credentials() override = default;
104 
107  const GetRequestMetadataArgs* args) override;
108 
110  return min_security_level_;
111  }
112 
113  const CallCredentialsList& inner() const { return inner_; }
114  std::string debug_string() override;
115 
117 
118  grpc_core::UniqueTypeName type() const override { return Type(); }
119 
120  private:
121  int cmp_impl(const grpc_call_credentials* other) const override {
122  // TODO(yashykt): Check if we can do something better here
124  static_cast<const grpc_call_credentials*>(this), other);
125  }
126 
128  bool is_composite);
131 };
132 
133 #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
134  */
grpc_composite_channel_credentials::~grpc_composite_channel_credentials
~grpc_composite_channel_credentials() override=default
grpc_call_credentials::GetRequestMetadataArgs
Definition: src/core/lib/security/credentials/credentials.h:196
grpc_composite_call_credentials::push_to_inner
void push_to_inner(grpc_core::RefCountedPtr< grpc_call_credentials > creds, bool is_composite)
Definition: composite_credentials.cc:87
grpc_composite_channel_credentials::type
grpc_core::UniqueTypeName type() const override
Definition: composite_credentials.cc:44
grpc_core::RefCountedPtr::get
T * get() const
Definition: ref_counted_ptr.h:146
grpc_composite_channel_credentials::create_security_connector
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:147
useful.h
grpc_composite_call_credentials::type
grpc_core::UniqueTypeName type() const override
Definition: composite_credentials.h:118
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_composite_call_credentials::min_security_level_
grpc_security_level min_security_level_
Definition: composite_credentials.h:129
grpc_composite_channel_credentials
Definition: composite_credentials.h:47
grpc_call_credentials
Definition: src/core/lib/security/credentials/credentials.h:189
grpc_call_credentials::cmp
int cmp(const grpc_call_credentials *other) const
Definition: src/core/lib/security/credentials/credentials.h:224
grpc_composite_call_credentials::inner
const CallCredentialsList & inner() const
Definition: composite_credentials.h:113
grpc_channel_credentials::update_arguments
virtual grpc_core::ChannelArgs update_arguments(grpc_core::ChannelArgs args)
Definition: src/core/lib/security/credentials/credentials.h:131
grpc_security.h
grpc_composite_call_credentials::~grpc_composite_call_credentials
~grpc_composite_call_credentials() override=default
credentials.h
grpc_channel_args
Definition: grpc_types.h:132
grpc_composite_call_credentials::debug_string
std::string debug_string() override
Definition: composite_credentials.cc:69
grpc_composite_channel_credentials::update_arguments
grpc_core::ChannelArgs update_arguments(grpc_core::ChannelArgs args) override
Definition: composite_credentials.h:68
grpc_types.h
o
UnboundConversion o
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:97
grpc_composite_call_credentials::min_security_level
grpc_security_level min_security_level() const override
Definition: composite_credentials.h:109
grpc_composite_channel_credentials::cmp_impl
int cmp_impl(const grpc_channel_credentials *other) const override
Definition: composite_credentials.h:82
grpc_composite_channel_credentials::duplicate_without_call_credentials
grpc_core::RefCountedPtr< grpc_channel_credentials > duplicate_without_call_credentials() override
Definition: composite_credentials.h:58
grpc_composite_channel_credentials::call_creds
const grpc_call_credentials * call_creds() const
Definition: composite_credentials.h:78
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_composite_channel_credentials::inner_creds
const grpc_channel_credentials * inner_creds() const
Definition: composite_credentials.h:75
grpc_core::RefCountedPtr< grpc_channel_credentials >
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
grpc_composite_call_credentials::inner_
CallCredentialsList inner_
Definition: composite_credentials.h:130
grpc.h
grpc_composite_call_credentials::Type
static grpc_core::UniqueTypeName Type()
Definition: composite_credentials.cc:64
security_connector.h
grpc_composite_channel_credentials::inner_creds_
grpc_core::RefCountedPtr< grpc_channel_credentials > inner_creds_
Definition: composite_credentials.h:89
grpc_composite_call_credentials::grpc_composite_call_credentials
grpc_composite_call_credentials(grpc_core::RefCountedPtr< grpc_call_credentials > creds1, grpc_core::RefCountedPtr< grpc_call_credentials > creds2)
Definition: composite_credentials.cc:100
arena_promise.h
grpc_channel_credentials::cmp
int cmp(const grpc_channel_credentials *other) const
Definition: src/core/lib/security/credentials/credentials.h:143
grpc_core::MetadataHandle< ClientMetadata >
grpc_composite_call_credentials
Definition: composite_credentials.h:95
grpc_security_level
grpc_security_level
Definition: grpc_security_constants.h:131
grpc_core::UniqueTypeName
Definition: unique_type_name.h:56
grpc_core::ArenaPromise
Definition: arena_promise.h:152
grpc_core::QsortCompare
int QsortCompare(const T &a, const T &b)
Definition: useful.h:95
fix_build_deps.r
r
Definition: fix_build_deps.py:491
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_security_constants.h
grpc_composite_call_credentials::GetRequestMetadata
grpc_core::ArenaPromise< absl::StatusOr< grpc_core::ClientMetadataHandle > > GetRequestMetadata(grpc_core::ClientMetadataHandle initial_metadata, const GetRequestMetadataArgs *args) override
Definition: composite_credentials.cc:52
grpc_composite_channel_credentials::call_creds_
grpc_core::RefCountedPtr< grpc_call_credentials > call_creds_
Definition: composite_credentials.h:90
unique_type_name.h
grpc_core::ChannelArgs
Definition: channel_args.h:111
ref_counted_ptr.h
transport.h
grpc_composite_call_credentials::CallCredentialsList
std::vector< grpc_core::RefCountedPtr< grpc_call_credentials > > CallCredentialsList
Definition: composite_credentials.h:98
channel_args.h
grpc_composite_channel_credentials::grpc_composite_channel_credentials
grpc_composite_channel_credentials(grpc_core::RefCountedPtr< grpc_channel_credentials > channel_creds, grpc_core::RefCountedPtr< grpc_call_credentials > call_creds)
Definition: composite_credentials.h:49
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
grpc_channel_credentials
Definition: src/core/lib/security/credentials/credentials.h:96
grpc_composite_call_credentials::cmp_impl
int cmp_impl(const grpc_call_credentials *other) const override
Definition: composite_credentials.h:121
grpc_composite_channel_credentials::mutable_call_creds
grpc_call_credentials * mutable_call_creds()
Definition: composite_credentials.h:79
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:52