evaluate_args.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
16 #define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
17 
19 
20 #include <string>
21 #include <vector>
22 
23 #include "absl/strings/string_view.h"
24 #include "absl/types/optional.h"
25 
26 #include <grpc/grpc_security.h>
27 
31 
32 namespace grpc_core {
33 
34 class EvaluateArgs {
35  public:
36  // Caller is responsible for ensuring auth_context outlives PerChannelArgs
37  // struct.
38  struct PerChannelArgs {
39  struct Address {
40  // The address in sockaddr form.
42  // The same address with only the host part.
44  int port = 0;
45  };
46 
47  PerChannelArgs(grpc_auth_context* auth_context, grpc_endpoint* endpoint);
48 
51  std::vector<absl::string_view> uri_sans;
52  std::vector<absl::string_view> dns_sans;
57  };
58 
60  : metadata_(metadata), channel_args_(channel_args) {}
61 
62  absl::string_view GetPath() const;
65  // Returns metadata value(s) for the specified key.
66  // If the key is not present in the batch, returns absl::nullopt.
67  // If the key is present exactly once in the batch, returns a string_view of
68  // that value.
69  // If the key is present more than once in the batch, constructs a
70  // comma-concatenated string of all values in concatenated_value and returns a
71  // string_view of that string.
73  absl::string_view key, std::string* concatenated_value) const;
74 
77  int GetLocalPort() const;
80  int GetPeerPort() const;
83  std::vector<absl::string_view> GetUriSans() const;
84  std::vector<absl::string_view> GetDnsSans() const;
87 
88  private:
91 };
92 
93 } // namespace grpc_core
94 
95 #endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
grpc_core::EvaluateArgs
Definition: evaluate_args.h:34
grpc_auth_context
Definition: security_context.h:63
metadata_batch.h
grpc_core::EvaluateArgs::GetPeerAddressString
absl::string_view GetPeerAddressString() const
Definition: evaluate_args.cc:162
metadata
Definition: cq_verifier.cc:48
grpc_core::EvaluateArgs::PerChannelArgs::dns_sans
std::vector< absl::string_view > dns_sans
Definition: evaluate_args.h:52
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::EvaluateArgs::PerChannelArgs::Address::port
int port
Definition: evaluate_args.h:44
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::EvaluateArgs::PerChannelArgs::uri_sans
std::vector< absl::string_view > uri_sans
Definition: evaluate_args.h:51
grpc_resolved_address
Definition: resolved_address.h:34
grpc_core::EvaluateArgs::PerChannelArgs::Address::address
grpc_resolved_address address
Definition: evaluate_args.h:41
grpc_security.h
resolved_address.h
grpc_core::EvaluateArgs::PerChannelArgs::common_name
absl::string_view common_name
Definition: evaluate_args.h:53
grpc_core::EvaluateArgs::GetLocalAddressString
absl::string_view GetLocalAddressString() const
Definition: evaluate_args.cc:141
grpc_core::EvaluateArgs::GetAuthority
absl::string_view GetAuthority() const
Definition: evaluate_args.cc:99
grpc_core::EvaluateArgs::PerChannelArgs::transport_security_type
absl::string_view transport_security_type
Definition: evaluate_args.h:49
grpc_core::EvaluateArgs::GetLocalPort
int GetLocalPort() const
Definition: evaluate_args.cc:148
grpc_core::EvaluateArgs::PerChannelArgs::local_address
Address local_address
Definition: evaluate_args.h:55
grpc_core::EvaluateArgs::EvaluateArgs
EvaluateArgs(grpc_metadata_batch *metadata, PerChannelArgs *channel_args)
Definition: evaluate_args.h:59
grpc_core::EvaluateArgs::GetPath
absl::string_view GetPath() const
Definition: evaluate_args.cc:89
absl::optional< absl::string_view >
grpc_core::EvaluateArgs::GetMethod
absl::string_view GetMethod() const
Definition: evaluate_args.cc:109
grpc_core::EvaluateArgs::PerChannelArgs::PerChannelArgs
PerChannelArgs(grpc_auth_context *auth_context, grpc_endpoint *endpoint)
Definition: evaluate_args.cc:69
grpc_core::EvaluateArgs::channel_args_
PerChannelArgs * channel_args_
Definition: evaluate_args.h:90
grpc_core::EvaluateArgs::metadata_
grpc_metadata_batch * metadata_
Definition: evaluate_args.h:89
grpc_core::EvaluateArgs::GetPeerPort
int GetPeerPort() const
Definition: evaluate_args.cc:169
grpc_core::EvaluateArgs::PerChannelArgs::subject
absl::string_view subject
Definition: evaluate_args.h:54
key
const char * key
Definition: hpack_parser_table.cc:164
grpc_core::EvaluateArgs::PerChannelArgs
Definition: evaluate_args.h:38
grpc_core::EvaluateArgs::GetPeerAddress
grpc_resolved_address GetPeerAddress() const
Definition: evaluate_args.cc:155
grpc_core::EvaluateArgs::GetLocalAddress
grpc_resolved_address GetLocalAddress() const
Definition: evaluate_args.cc:134
grpc_core::EvaluateArgs::PerChannelArgs::Address::address_str
std::string address_str
Definition: evaluate_args.h:43
grpc_core::EvaluateArgs::PerChannelArgs::spiffe_id
absl::string_view spiffe_id
Definition: evaluate_args.h:50
grpc_core::EvaluateArgs::GetSpiffeId
absl::string_view GetSpiffeId() const
Definition: evaluate_args.cc:183
grpc_core::EvaluateArgs::GetUriSans
std::vector< absl::string_view > GetUriSans() const
Definition: evaluate_args.cc:190
grpc_core::EvaluateArgs::GetTransportSecurityType
absl::string_view GetTransportSecurityType() const
Definition: evaluate_args.cc:176
grpc_core::EvaluateArgs::GetDnsSans
std::vector< absl::string_view > GetDnsSans() const
Definition: evaluate_args.cc:197
endpoint.h
grpc_core::EvaluateArgs::GetSubject
absl::string_view GetSubject() const
Definition: evaluate_args.cc:211
grpc_metadata_batch
Definition: metadata_batch.h:1259
grpc_core::EvaluateArgs::GetCommonName
absl::string_view GetCommonName() const
Definition: evaluate_args.cc:204
grpc_endpoint
Definition: endpoint.h:105
grpc_core::EvaluateArgs::GetHeaderValue
absl::optional< absl::string_view > GetHeaderValue(absl::string_view key, std::string *concatenated_value) const
Definition: evaluate_args.cc:119
grpc_core::EvaluateArgs::PerChannelArgs::peer_address
Address peer_address
Definition: evaluate_args.h:56
port_platform.h
grpc_core::EvaluateArgs::PerChannelArgs::Address
Definition: evaluate_args.h:39


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:16