grpcpp/impl/codegen/security/auth_context.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 GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
20 #define GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
21 
22 // IWYU pragma: private, include <grpcpp/security/auth_context.h>
23 
24 #include <iterator>
25 #include <vector>
26 
29 
30 struct grpc_auth_context;
31 struct grpc_auth_property;
33 
34 namespace grpc {
36 
37 typedef std::pair<string_ref, string_ref> AuthProperty;
38 
40  public:
41  using iterator_category = std::forward_iterator_tag;
42  using value_type = const AuthProperty;
43  using pointer = void;
44  using reference = void;
45  using difference_type = std::ptrdiff_t;
46 
50  bool operator==(const AuthPropertyIterator& rhs) const;
51  bool operator!=(const AuthPropertyIterator& rhs) const;
53 
54  protected:
58 
59  private:
60  friend class SecureAuthContext;
62  // The following items form a grpc_auth_property_iterator.
64  size_t index_;
65  const char* name_;
66 };
67 
72 class AuthContext {
73  public:
74  virtual ~AuthContext() {}
75 
77  virtual bool IsPeerAuthenticated() const = 0;
78 
83  virtual std::vector<grpc::string_ref> GetPeerIdentity() const = 0;
84  virtual std::string GetPeerIdentityPropertyName() const = 0;
85 
87  virtual std::vector<grpc::string_ref> FindPropertyValues(
88  const std::string& name) const = 0;
89 
91  virtual AuthPropertyIterator begin() const = 0;
92  virtual AuthPropertyIterator end() const = 0;
93 
95  virtual void AddProperty(const std::string& key, const string_ref& value) = 0;
96  virtual bool SetPeerIdentityPropertyName(const std::string& name) = 0;
97 };
98 
99 } // namespace grpc
100 
101 #endif // GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
grpc::string_ref
Definition: grpcpp/impl/codegen/string_ref.h:43
grpc::AuthPropertyIterator::~AuthPropertyIterator
~AuthPropertyIterator()
Definition: auth_property_iterator.cc:37
grpc_auth_context
Definition: security_context.h:63
grpc::AuthPropertyIterator::operator*
AuthProperty operator*()
Definition: auth_property_iterator.cc:66
grpc::AuthContext::SetPeerIdentityPropertyName
virtual bool SetPeerIdentityPropertyName(const std::string &name)=0
grpc::AuthPropertyIterator::ctx_
const grpc_auth_context * ctx_
Definition: grpcpp/impl/codegen/security/auth_context.h:63
grpc
Definition: grpcpp/alarm.h:33
grpc::AuthPropertyIterator::operator!=
bool operator!=(const AuthPropertyIterator &rhs) const
Definition: auth_property_iterator.cc:62
grpc::AuthContext::FindPropertyValues
virtual std::vector< grpc::string_ref > FindPropertyValues(const std::string &name) const =0
Returns all the property values with the given name.
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
setup.name
name
Definition: setup.py:542
grpc::AuthContext::IsPeerAuthenticated
virtual bool IsPeerAuthenticated() const =0
Returns true if the peer is authenticated.
config.h
grpc::AuthPropertyIterator::name_
const char * name_
Definition: grpcpp/impl/codegen/security/auth_context.h:65
grpc::AuthPropertyIterator::pointer
void pointer
Definition: grpcpp/impl/codegen/security/auth_context.h:43
grpc::AuthPropertyIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: grpcpp/impl/codegen/security/auth_context.h:41
grpc::AuthPropertyIterator::operator==
bool operator==(const AuthPropertyIterator &rhs) const
Definition: auth_property_iterator.cc:54
grpc::AuthContext::AddProperty
virtual void AddProperty(const std::string &key, const string_ref &value)=0
Mutation functions: should only be used by an AuthMetadataProcessor.
grpc_auth_property_iterator
Definition: grpc_security.h:36
grpc::AuthPropertyIterator::property_
const grpc_auth_property * property_
Definition: grpcpp/impl/codegen/security/auth_context.h:61
grpc::AuthPropertyIterator::difference_type
std::ptrdiff_t difference_type
Definition: grpcpp/impl/codegen/security/auth_context.h:45
grpc::AuthContext::GetPeerIdentityPropertyName
virtual std::string GetPeerIdentityPropertyName() const =0
grpc_auth_property
Definition: grpc_security.h:43
value
const char * value
Definition: hpack_parser_table.cc:165
string_ref.h
grpc::SecureAuthContext
Definition: secure_auth_context.h:35
key
const char * key
Definition: hpack_parser_table.cc:164
grpc::AuthPropertyIterator::value_type
const AuthProperty value_type
Definition: grpcpp/impl/codegen/security/auth_context.h:42
grpc::AuthPropertyIterator::operator++
AuthPropertyIterator & operator++()
Definition: auth_property_iterator.cc:39
grpc::AuthContext::begin
virtual AuthPropertyIterator begin() const =0
Iteration over all the properties.
grpc::AuthPropertyIterator
Definition: grpcpp/impl/codegen/security/auth_context.h:39
grpc::AuthPropertyIterator::index_
size_t index_
Definition: grpcpp/impl/codegen/security/auth_context.h:64
grpc::AuthProperty
std::pair< string_ref, string_ref > AuthProperty
Definition: grpcpp/impl/codegen/security/auth_context.h:35
iter
Definition: test_winkernel.cpp:47
grpc::AuthContext::end
virtual AuthPropertyIterator end() const =0
grpc::AuthPropertyIterator::AuthPropertyIterator
AuthPropertyIterator()
Definition: auth_property_iterator.cc:27
grpc::AuthContext::GetPeerIdentity
virtual std::vector< grpc::string_ref > GetPeerIdentity() const =0
grpc::AuthContext
Definition: grpcpp/impl/codegen/security/auth_context.h:72
grpc::AuthContext::~AuthContext
virtual ~AuthContext()
Definition: grpcpp/impl/codegen/security/auth_context.h:74
grpc::AuthPropertyIterator::reference
void reference
Definition: grpcpp/impl/codegen/security/auth_context.h:44


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