Skip to content

Commit

Permalink
Merge pull request #43 from silicon-heaven/user-id
Browse files Browse the repository at this point in the history
Add userId definition and login nonce retransmition rules.
  • Loading branch information
fvacek authored Sep 25, 2024
2 parents b12b1d2 + 800cb3d commit 542ddc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/rpcmessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ should be used to get level if this field is not present. *Admin* access level
should be considered as the base limit if neither `AccessLevel` nor `Access`
field is present.

`userId` is string containing information about the login names and the
broker names along the RPC message path through the brokers hierarchy. The format
is`user-name1:broker-name1;user-name2:broker-name2;...`, for example:
`[email protected]:broker1;broker1-login:broker2`. User name and broker name is delimited by `:`,
user:broker pairs are delimited by ';'.

`Access` is older approach for the access control. It is assigned to request by
broker according to user rights. Multiple grants can be specified and separated
by comma. This is no longer the primary way and is used only for pre-SHV 3.0
Expand Down
9 changes: 5 additions & 4 deletions src/rpcmethods/broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ client.

| Parameter | Result |
|-----------|---------------|
| Null | [String, ...] |
| Null | {String: Int \| Null, ...} |

List of strings is provided where strings are [resource identifiers for
signals](../rpcri.md) for the existing subscriptions.
Map of strings to int key value pairs is provided where keys are [resource identifiers for
signals](../rpcri.md) and values are TTL remaining for the existing subscriptions. Null TTL
means, that the subscription lasts forever.

```
=> <id:42, method:"subscriptions", path:".broker/currentClient">i{}
Expand All @@ -143,7 +144,7 @@ Information the broker has on the client.

| Parameter | Result |
|-----------|------------------------------------------------------------------------------------------------------------------|
| Int | {"clientId":Int, "userName":String\|Null, "mountPoint":String\|Null, "subscriptions":[String, ...], ...} \| Null |
| Int | {"clientId":Int, "userName":String\|Null, "mountPoint":String\|Null, "subscriptions":{String: Int \| Null, ... }, ...} \| Null |

The parameter is client's ID (*Int*). The provided value is *Map* with info
about the client. The *Null* is provided in case there is no client with this
Expand Down
4 changes: 3 additions & 1 deletion src/rpcmethods/login.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ established needs to be `hello` request. It is called with `null` SHV path

Broker should respond with message containing nonce that can be used to perform
login. The nonce needs to be an ASCII string with length from 10 to 32
characters.
characters. The nonce must be the same in case, of `hello` message retransmit
during the login phase. Some clients might send more `hello` message to discover,
that shvbroker is started and ready, especially on serial port.

```
<= <id:1>i{2:{"nonce":"vOLJaIZOVevrDdDq"}}
Expand Down

0 comments on commit 542ddc8

Please sign in to comment.