mirror of
https://github.com/jpace121/j7s-jwt-mosquitto-auth.git
synced 2026-11-03 15:27:46 +00:00
Better handle missing usernames. Fix test.
This commit is contained in:
1 parent
a319e7f3c7
commit
b18ed96444
3 files changed
+9
-3
No files matched your search
+1
-1
@@ -46,7 +46,7 @@ void Authorizer::add_unknown(const std::string& username)
|
||||
|
||||
bool Authorizer::is_unknown(const std::string& username)
|
||||
{
|
||||
return _unknownList.confirm(username);
|
||||
return (username.empty() or _unknownList.confirm(username));
|
||||
}
|
||||
|
||||
bool Authorizer::add(const std::string& token, const std::string& username)
|
||||
|
||||
+7
-1
@@ -102,7 +102,13 @@ int jwp_auth_basic_auth_callback(int event, void *event_data, void *userdata)
|
||||
|
||||
struct mosquitto_evt_basic_auth *auth_data = static_cast<struct mosquitto_evt_basic_auth*>(event_data);
|
||||
|
||||
if(!auth_data->username or !auth_data->password)
|
||||
if(!auth_data->username)
|
||||
{
|
||||
// We need a username to do anything.
|
||||
return MOSQ_ERR_PLUGIN_DEFER;
|
||||
}
|
||||
|
||||
if(!auth_data->password)
|
||||
{
|
||||
authorizer->add_unknown(std::string(auth_data->username));
|
||||
return MOSQ_ERR_PLUGIN_DEFER;
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
/usr/local/sbin/mosquitto -v -c $PWD/mosquitto.conf
|
||||
/usr/sbin/mosquitto -v -c $PWD/mosquitto.conf
|
||||
Reference in new issue
Block a user