Domain | Field Name | Example Value | Required |
Decision | effect | allow/deny | Yes |
Operation | actions | ["connect", "pub", "sub"] | Yes |
Resource | topics | ["home/room1/*", "sensor/temperature/0"] | No |
Condition | clientId | "sensor*" | No |
| username | "user*" | No |
| qos | [0, 1, 2] | No |
| retain | true/false | No |
| ip | client IP address: 10.0.0.1 or CIDR 10.0.0.0/16 | No |

${PolicyVariable} with the actual value and then proceed with the match.Variable Name/Policy Variable | Semantics |
Username | MQTT client connection username. |
ClientId | MQTT client ID. |
Certificate.Subject.Country | Certificate's country information in the one-device-one-certificate scenario. For details, see RFC4519. |
Certificate.Subject.Organization | Certificate's organization information in the one-device-one-certificate scenario. For details, see RFC4519. |
Certificate.Subject.OrganizationalUnit | Certificate's organizational unit information in the one-device-one-certificate scenario. For details, see RFC4519. |
Certificate.Subject.State | Certificate's province and municipality information in the one-device-one-certificate scenario. For details, see RFC4519. |
Certificate.Subject.CommonName | |
Certificate.Subject.SerialNumber |
CAR-123 ("CAR" being a fixed prefix), and you want it to only subscribe to the vehicle number-related Topic /123/status, simply configure the policy Topic as: /${clientId.substring(4)}/statusVariable Name | Expression Writing Format | Description |
Client ID | ${clientId} | Unique identifier used in client connections |
Username | ${username} | Username used in client connections |
Common Method | Description | Example (Input: "WA123456") |
substring(int beginIndex) | Extracts a substring starting from the specified index to the end of the string. | ${clientId.substring(2)} Output result: "123456" |
substring(int beginIndex, int endIndex) | Extracts consecutive characters starting from begin to end (exclusive of end). | ${clientId.substring(0, 2)} Output result: "WA" |
startsWith(prefix) | Determines whether it starts with the specified prefix. | ${clientId.startsWith('WA')} Output result: true |
Wildcard | Semantics |
+ | Consistent with MQTT protocol Topic Filter Wildcard |
# | Consistent with MQTT protocol Topic Filter Wildcard |
? | Any single character |
* | Any number of characters |
Wildcard | Semantics |
? | Any single character |
* | Any number of characters |
default_allow_all indicates no policy control by default (allowing all data plane actions). If authorization policies need to be enabled, you may add new policies or modify the current default_allow_all policy.
Configuration Item | Description |
Policy name | Sets the policy name. It must comply with the naming rules: 3-64 characters, supporting Chinese characters, letters, numbers, hyphens (-), and underscores (_). |
Description | Optional. It must not exceed 128 characters. |
Creation method | Supports visual policy configuration and JSON file configuration. |
Effect | "Allow" or "Deny". If selected "Allow", it means that the client operation can be used when the configured conditions are met. If selected "Deny", the client operation will be rejected when the configured conditions are met. |
Operation | The authorization policy supports multiple selections for different requests, including Connect, Publish, and Subscribe. |
Topic | |
Username | Optional. Enter a single username or resource expression. Wildcards and policy variables are supported. For details, see Expression Description. Leave blank to support all usernames. |
Client ID | Optional. Enter a single resource expression. Wildcards and policy variables are supported. For details, see Expression Description. Leave blank or enter * to support all clients. |
IP address | Optional. Only supports entering a single IP (e.g., 192.168.0.1) or CIDR format (e.g., 192.168.1.0/24). Note: Client IP addresses have a dynamic nature. If IP address-based ACL policies are configured, security risks such as authorization failure or unauthorized access may occur. Exercise caution when configuring based on your business scenarios. |
QoS | Select a QoS level supported by authorization policies. |
Message type | Select a message type supported by authorization policies: retain message and normal message. Selecting all options indicates support for all message types. |
{"effect":"allow","actions":["connect","pub","sub"],"topics":["*"],"condition":{"ip":"0.0.0.0/0","clientId":"","username":"","qos":[0,1,2],"retain":["true","false"]}}
{"effect": "deny","actions": ["connect","pub","sub"],"topics": ["*"],"condition": {"ip": "0.0.0.0/0","clientId": "","username": "","qos": [0,1,2],"retain": ["true","false"]}}
{"effect":"allow","actions":["connect","pub"],"topics":["topicA/test"],"condition":{"ip":"0.0.0.0/0","clientId":"","username":"","qos":[0,1,2],"retain":["true","false"]}}
{"effect": "allow","actions": ["connect","pub"],"topics": ["home/sensor", "device/1"],"condition": {"ip": "0.0.0.0/0","clientId": "","username": "","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "allow","actions": ["connect","pub"],"topics": ["home/#", "device/+"],"condition": {"ip": "0.0.0.0/0","clientId": "","username": "","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "allow","actions": ["connect","pub"],"topics": ["prefix*", "*suffix"],"condition": {"ip": "0.0.0.0/0","clientId": "","username": "","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "allow","actions": ["connect"],"topics": ["*"],"condition": {"ip": "0.0.0.0/0","clientId": "*${Username}*","username": "","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "deny","actions": ["connect"],"topics": ["*"],"condition": {"ip": "0.0.0.0/0","clientId": "*","username": "*root*","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "allow","actions": ["connect", "sub"],"topics": ["*"],"condition": {"ip": "192.168.0.0/16","clientId": "*","username": "*","qos": [0,1,2],"retain": ["true","false"]}}
{"effect": "allow","actions": ["connect", "pub", "sub"],"topics": ["home/${Username}/+", "sensor/${ClientId}/#"],"condition": {"ip": "192.168.0.0/16","clientId": "*${Certificate.Subject.CommonName}*","username": "*","qos": [0,1,2],"retain": ["true","false"]}}
{"effect":"allow","actions":["sub"],"topics":["/device/${clientId.substring(4)}/+"],"condition": {"ip": "0.0.0.0/0","clientId": "","username": "","qos": [0,1,2],"retain": ["true","false"]}}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback