Credentials
The authentication module can secure access to the web interface and HTTP API by verifying credentials. When enabled, the module requires Digest Access Authentication according to RFC 2617. The realm used is esp32-lib.
Chargers use the more powerful users module.
Chargers use the more powerful users module.
Chargers use the more powerful users module.
authentication/config
Credentials to be requested for using the web interface and HTTP API.
# $HOST e.g. wem-AbCd
Read
curl http://$HOST/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
curl http://$HOST/authentication/config -d '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. wem/AbCd
Read
mosquitto_sub -v -C 1 -h $BROKER -t $PREFIX/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
With MQTT on $PREFIX/authentication/config_update
mosquitto_pub -h $BROKER -t $PREFIX/authentication/config_update -m '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
| Name | Description |
|---|---|
enable_authbool | Specifies whether credentials should be required for using the web interface and HTTP API.
|
usernamestring | The username to be granted access to the web interface and HTTP API. |
digest_hashstring | The Digest Hash (HA1) to be granted access to the web interface and HTTP API. The realm used is |
authentication/config
Credentials to be requested for using the web interface and HTTP API.
# $HOST e.g. wem2-AbCd
Read
curl http://$HOST/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
curl http://$HOST/authentication/config -d '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. wem2/AbCd
Read
mosquitto_sub -v -C 1 -h $BROKER -t $PREFIX/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
With MQTT on $PREFIX/authentication/config_update
mosquitto_pub -h $BROKER -t $PREFIX/authentication/config_update -m '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
| Name | Description |
|---|---|
enable_authbool | Specifies whether credentials should be required for using the web interface and HTTP API.
|
usernamestring | The username to be granted access to the web interface and HTTP API. |
digest_hashstring | The Digest Hash (HA1) to be granted access to the web interface and HTTP API. The realm used is |
authentication/config
Credentials to be requested for using the web interface and HTTP API.
# $HOST e.g. warp-AbCd
Read
curl http://$HOST/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
curl http://$HOST/authentication/config -d '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
# $BROKER e.g. my_mosquitto.localdomain
# $PREFIX e.g. warp/AbCd
Read
mosquitto_sub -v -C 1 -h $BROKER -t $PREFIX/authentication/config
{
"enable_auth": true,
"username": "testuser",
// Not returned
"digest_hash": null
}
Write
With MQTT on $PREFIX/authentication/config_update
mosquitto_pub -h $BROKER -t $PREFIX/authentication/config_update -m '{
"enable_auth": true,
"username": "testuser",
"digest_hash": "926011006c2686471698e86690b7e500"
}'
"digest_hash" = MD5("testuser:esp32-lib:testpass")
| Name | Description |
|---|---|
enable_authbool | Specifies whether credentials should be required for using the web interface and HTTP API.
|
usernamestring | The username to be granted access to the web interface and HTTP API. |
digest_hashstring | The Digest Hash (HA1) to be granted access to the web interface and HTTP API. The realm used is |