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
@@ -155,17 +155,27 @@ To create this *BrokerAuthorization* resource, apply the YAML manifest to your K
155
155
156
156
---
157
157
158
-
This broker authorization allows clients with usernames`temperature-sensor` or `humidity-sensor`, or clients with attributes `organization` with value `contoso` and `city` with value `seattle`, to:
158
+
This broker authorization allows clients with client IDs`temperature-sensor` or `humidity-sensor`, or clients with attributes `organization` with value `contoso` and `city` with value `seattle`, to:
159
159
160
160
- Connect to the broker.
161
-
- Publish messages to telemetry topics scoped with their usernames and organization. For example:
161
+
- Publish messages to telemetry topics scoped with their client IDs and organization. For example:
162
162
- `temperature-sensor`can publish to `/telemetry/temperature-sensor` and `/telemetry/contoso`.
163
163
- `humidity-sensor`can publish to `/telemetry/humidity-sensor` and `/telemetry/contoso`.
164
164
- `some-other-username`can publish to `/telemetry/contoso`.
165
165
- Subscribe to commands topics scoped with their organization. For example:
166
166
- `temperature-sensor`can subscribe to `/commands/contoso`.
167
167
- `some-other-username`can subscribe to `/commands/contoso`.
168
168
169
+
### Using username for authorization
170
+
171
+
To use the MQTT username for authorization, specify them as an array under `principals.usernames`. However, depending on the authentication method, the username might not be verified:
172
+
173
+
- **Kubernetes SAT** - Username shouldn't be used for authorization because it's not verified for MQTTv5 with enhanced authentication.
174
+
- **X.509** - Username matches the CN from certificate and can be used for authorization rules.
175
+
- **Custom** - Username should only be used for authorization rules if custom authentication validates the username.
176
+
177
+
To prevent security issues, only use the MQTT username for broker authorization when it can be verified.
178
+
169
179
### Further limit access based on client ID
170
180
171
181
Because the `principals` field is a logical OR, you can further restrict access based on client ID by adding the `clientIds` field to the `brokerResources` field. For example, to allow clients with client IDs that start with its building number to connect and publish telemetry to topics scoped with their building, use the following configuration:
0 commit comments