You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+198-6Lines changed: 198 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,13 +63,205 @@ plugins of EMQ for forwarding these requests to Soteria and doing Authentication
63
63
EMQ has caching mechanism, but it sends requests almost for each Publish message to Soteria.
64
64
PS: On Subscribe we have only one message from client that need authorization and other messages are coming from server.
65
65
66
-
## Deployment
66
+
## Architecture
67
67
68
-
### Add Vendor
68
+

69
69
70
-
Soteria is a multivendor authenticator for EMQX.
71
-
Follow instruction from [here](docs/vendor.md)
70
+
## Support Vendors
72
71
73
-
### Architecture
72
+
Soteria supports having multiple vendors at the same time.
73
+
Means you can use single cluster for multiple companies at the same time and validate their tokens
74
+
and control accesses.
74
75
75
-

76
+
### Vendor Configuration
77
+
78
+
```yaml
79
+
company: "<<company_name>>"
80
+
driver_salt: ""
81
+
passenger_salt: ""
82
+
passenger_hash_length: 15
83
+
driver_hash_length: 15
84
+
allowed_access_types: ["pub", "sub"]
85
+
keys:
86
+
iss-0: "key-value"
87
+
iss-1: "key-value"
88
+
iss_entity_map:
89
+
0: "entity-0"
90
+
1: "entity-1"
91
+
default: "default-entity"
92
+
iss_peer_map:
93
+
0: "peer-0"
94
+
1: "peer-1"
95
+
default: "default-peer"
96
+
jwt:
97
+
iss_name: "iss"
98
+
sub_name: "sub"
99
+
signing_method: "RS512"
100
+
topics:
101
+
- topic1
102
+
- topic2
103
+
- ...
104
+
```
105
+
106
+
### HashID Manager
107
+
108
+
`driver_salt`,`passenger_salt`, `passenger_hash_length`, `driver_hash_length` are used for HashIDManager.
109
+
This component only works for passenger and driver issuers.
110
+
111
+
### Keys
112
+
113
+
This is a map of issuer to key for opening JWT token.
114
+
115
+
#### IssEntityMap & IssPeerMap
116
+
117
+
These two configuration map iss to entity and peer respectively.
118
+
119
+
**Note**: default case is `required`
120
+
121
+
```yaml
122
+
iss_entity_map:
123
+
0: "driver"
124
+
1: "passenger"
125
+
default: "none"
126
+
iss_peer_map:
127
+
0: "passenger"
128
+
1: "driver"
129
+
default: "none"
130
+
```
131
+
132
+
In the example above, we have two maps for entity & peer maps. As it's clear for **entity** structure **0** and **1** is mapped to **driver** and **passenger**, respectively. Vice Versa, for peer structure it can be seen that **1** and **0** is mapped to **driver** and **passenger**. We have also the **default** key for both two cases.
133
+
134
+
In the topic example, we have an accesses section in which **0** is mapped to **2** and **1** is mapped to **-1** which can be interpreted as a map from **IssEntity's Keys** to **Access Types**. In the other words this structure means:
135
+
136
+
- **Driver** has a **Pub** access on topic
137
+
- **Passenger** has a **None** access on topic (No Access)
138
+
139
+
### JWT
140
+
141
+
This is the JWT configuration. `iss_name` and `sub_name` are the name of issuer
142
+
and subject in the JWT token's payload respectively.
143
+
144
+
`signing_method`is the method that is used to sign the JWT token.
145
+
Here are list of different signing methods
146
+
147
+
- ES384
148
+
- RS512 \*
149
+
- PS512
150
+
- RS384 \*
151
+
- HS256 \*
152
+
- HS384 \*
153
+
- RS256 \*
154
+
- PS384
155
+
- ES256
156
+
- ES512
157
+
- EdDSA
158
+
- HS512 \*
159
+
- PS256
160
+
**Note**: only the methods with `*` are supported for now.
161
+
162
+
### Topic Configuration
163
+
164
+
```yaml
165
+
type: "<<Name>>"
166
+
template: "<<regex template>>"
167
+
hash_type: 0|1
168
+
accesses:
169
+
iss-0: "<<access>>"
170
+
iss-1: "<<access>>"
171
+
```
172
+
173
+
### Template
174
+
175
+
Topic template is a string consist of [Variables](##Available_Variables) and [Functions](##Available_Functions)
176
+
and regular expressions.
177
+
178
+
Variables and Function are replaced first, and then the whole template will compile as a regular expression.
179
+
The end result will be compared against the requested topic.
180
+
181
+
#### Example
182
+
183
+
This is template topic given in `vendor:topics[#]:template`.
0 commit comments