Simple Authentication Plugin
simple auth plugin is a simple MQTT authentication plugin that provides basic username/password authentication functionality.
Features
Section titled "Features"- Support multi-user configuration
- Simple username/password authentication mechanism
- Easy to configure and use
Configuration
Section titled "Configuration"Configure user account information in plugin.yaml, format as follows:
accounts: - username: admin password: adminUsage Instructions
Section titled "Usage Instructions"- Install the plugin to the MQTT server
- Configure user accounts in
plugin.yaml - Restart the MQTT service for configuration to take effect
- Passwords are stored in plain text, please keep the configuration file secure
- Recommend using more secure authentication methods in production environments
Workflow Diagram
Section titled "Workflow Diagram"Authentication Swimlane Diagram
Section titled "Authentication Swimlane Diagram"sequenceDiagram
autonumber
participant Client as MQTT Client
participant Broker as MQTT Broker
participant Plugin as Simple Auth Plugin
participant Config as plugin.yaml Config
Client->>Broker: 1. CONNECT packet<br/>(username + password)
Broker->>Plugin: 2. Forward authentication request<br/>(extract credentials)
Plugin->>Config: 3. Query account list
Config-->>Plugin: 4. Return matching account
alt Account exists and password matches
Plugin-->>Broker: 5. Return authentication success
Broker-->>Client: 6. CONNACK(return code 0)<br/>Connection successful
Note over Client,Broker: Subsequent MQTT communication
else Account doesn't exist or password incorrect
Plugin-->>Broker: 5. Return authentication failure
Broker-->>Client: 6. CONNACK(return code 4)<br/>Authentication failed
Broker->>Client: 7. Disconnect TCP connection
end
Flow Description
Section titled "Flow Description"- CONNECT Packet: Client sends connection request to Broker, carrying username and password
- Account Lookup: Plugin looks up matching account from
plugin.yamlconfiguration - Identity Verification: Compare username and password in request with configured account information
- Result Processing:
- Verification passed: Return connection successful, allow client subsequent communication
- Verification failed: Reject connection and disconnect client