Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
src
core
lib
security
authorization
grpc_authorization_engine.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_GRPC_AUTHORIZATION_ENGINE_H
16
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_GRPC_AUTHORIZATION_ENGINE_H
17
18
#include <
grpc/support/port_platform.h
>
19
20
#include <stddef.h>
21
22
#include <memory>
23
#include <string>
24
#include <vector>
25
26
#include "
src/core/lib/security/authorization/authorization_engine.h
"
27
#include "
src/core/lib/security/authorization/evaluate_args.h
"
28
#include "
src/core/lib/security/authorization/matchers.h
"
29
#include "
src/core/lib/security/authorization/rbac_policy.h
"
30
31
namespace
grpc_core
{
32
33
// GrpcAuthorizationEngine can be either an Allow engine or Deny engine. This
34
// engine makes authorization decisions to Allow or Deny incoming RPC request
35
// based on permission and principal configs in the provided RBAC policy and the
36
// engine type. This engine ignores condition field in RBAC config. It is the
37
// caller's responsibility to provide RBAC policies that are compatible with
38
// this engine.
39
class
GrpcAuthorizationEngine
:
public
AuthorizationEngine
{
40
public
:
41
// Builds GrpcAuthorizationEngine without any policies.
42
explicit
GrpcAuthorizationEngine
(
Rbac::Action
action
) :
action_
(
action
) {}
43
// Builds GrpcAuthorizationEngine with allow/deny RBAC policy.
44
explicit
GrpcAuthorizationEngine
(
Rbac
policy);
45
46
GrpcAuthorizationEngine
(
GrpcAuthorizationEngine
&& other) noexcept;
47
GrpcAuthorizationEngine
&
operator=
(
GrpcAuthorizationEngine
&& other) noexcept;
48
49
Rbac::Action
action
()
const
{
return
action_
; }
50
51
// Required only for testing purpose.
52
size_t
num_policies
()
const
{
return
policies_
.size(); }
53
54
// Evaluates incoming request against RBAC policy and makes a decision to
55
// whether allow/deny this request.
56
Decision
Evaluate
(
const
EvaluateArgs
&
args
)
const override
;
57
58
private
:
59
struct
Policy
{
60
std::string
name
;
61
std::unique_ptr<AuthorizationMatcher>
matcher
;
62
};
63
Rbac::Action
action_
;
64
std::vector<Policy>
policies_
;
65
};
66
67
}
// namespace grpc_core
68
69
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_GRPC_AUTHORIZATION_ENGINE_H
grpc_core::EvaluateArgs
Definition:
evaluate_args.h:34
grpc_core::GrpcAuthorizationEngine::Policy::matcher
std::unique_ptr< AuthorizationMatcher > matcher
Definition:
grpc_authorization_engine.h:61
grpc_core::GrpcAuthorizationEngine::num_policies
size_t num_policies() const
Definition:
grpc_authorization_engine.h:52
grpc_core
Definition:
call_metric_recorder.h:31
testing::internal::string
::std::string string
Definition:
bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
authorization_engine.h
grpc_core::GrpcAuthorizationEngine::GrpcAuthorizationEngine
GrpcAuthorizationEngine(Rbac::Action action)
Definition:
grpc_authorization_engine.h:42
grpc_core::GrpcAuthorizationEngine::operator=
GrpcAuthorizationEngine & operator=(GrpcAuthorizationEngine &&other) noexcept
Definition:
grpc_authorization_engine.cc:42
grpc_core::GrpcAuthorizationEngine
Definition:
grpc_authorization_engine.h:39
evaluate_args.h
asyncio_get_stats.args
args
Definition:
asyncio_get_stats.py:40
grpc_core::Rbac::Action
Action
Definition:
rbac_policy.h:36
matchers.h
rbac_policy.h
grpc_core::GrpcAuthorizationEngine::Policy
Definition:
grpc_authorization_engine.h:59
grpc_core::GrpcAuthorizationEngine::Evaluate
Decision Evaluate(const EvaluateArgs &args) const override
Definition:
grpc_authorization_engine.cc:49
grpc_core::GrpcAuthorizationEngine::action_
Rbac::Action action_
Definition:
grpc_authorization_engine.h:63
grpc_core::Rbac
Definition:
rbac_policy.h:35
grpc_core::GrpcAuthorizationEngine::policies_
std::vector< Policy > policies_
Definition:
grpc_authorization_engine.h:64
grpc_core::AuthorizationEngine
Definition:
authorization_engine.h:28
grpc_core::GrpcAuthorizationEngine::action
Rbac::Action action() const
Definition:
grpc_authorization_engine.h:49
grpc_core::GrpcAuthorizationEngine::Policy::name
std::string name
Definition:
grpc_authorization_engine.h:60
port_platform.h
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:47