-
Notifications
You must be signed in to change notification settings - Fork 13
shv access control
Fanda Vacek edited this page Nov 15, 2020
·
42 revisions
- Each user has list of roles defined and accessible to shvbroker. Each role has property
weight
of typeint
defined. - Each SHV method defines its
accessLevel
as a number > 0 or string which must be convertible to access level int by node, see methodShvNode::grantToAccessLevel(...)
.accessLevel == 0
means no-access. - When client calls the RPC method, then shvbroker check access list (ACL) for all the user's
roles sorted by weight DESC
. - For
role
in roles sorted byweight
, greatest first- For
access-rule
in acces-rules forrole
sorted by most specific rule first- if request
shvPath
matchesaccess-rule
- then
grant
of this role is assigned to RPC request asAccessGrant
meta-value and it is sent to the client. It is up to the client implementation whether it checks theaccessGrant
or not. - stop searching with success
- then
- if request
- For
- 'Operation not permitted' RPC error is returned, because
shvPath
match is not found for any ofrole
of anyweight
Access rule consist of:
- path-pattern, which might have form:
shv-path
shv-path/**
- method-pattern, which might have form:
method-name
- empty string
- access-grant, will be explained later in Access Grant Following access rules examples are sorted from most specific to least specific
path pattern | method pattern |
---|---|
foo/bar |
baz |
foo |
baz |
foo/bar/** |
baz |
foo/** |
baz |
** |
baz |
foo/bar |
`` |
foo |
`` |
foo/bar/** |
`` |
foo/** |
`` |
** |
`` |
Acces grant is rpc value of next forms:
-
Int
, then it isaccessLevel
. -
String
, then id isRole
. -
IMap
, then it isAccessGrant
, meta typeAccessGrant
is optional.- Possible fields: Type = 1, NotResolved, Role, AccessLevel, User, Password, LoginType
Access grants in client requests are removed by broker form security reasons. Only broker can set this field in RpcRequest.
- If slave broker receives RpcMessage
- if
grant
field IS SET, then RpcMessage is forwarded downstream with original grant unchanged. Request is authorized by master broker. - if
grant
field IS NOT SET, then rolemasterBroker
is used in access grant resolution usingaccess
table. This is used mainly for service calls as (un)subscribe propagation to slave brokers etc.
- if
- If client receives RpcMessage
- Access grant from RpcMessage is converted to
accessLevel
by methodShvNode::grantToAccessLevel(...)
on client implementation.
- Access grant from RpcMessage is converted to