aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-11-12 00:33:57 +0100
committerKim Alvefur <zash@zash.se>2023-11-12 00:33:57 +0100
commit5c773be087fa2eb2f012d67267a923803c61a254 (patch)
tree41d68d3c255ce1df80c2c892b0a6e8f29636fa06 /plugins
parent019549e7381ef1524bbb6550eb0140661ae3d4a5 (diff)
downloadprosody-5c773be087fa2eb2f012d67267a923803c61a254.tar.gz
prosody-5c773be087fa2eb2f012d67267a923803c61a254.zip
mod_tokenauth: Include more details in debug logs
Had a hard time following what was happening when it did not specify which grant or token was being removed.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_tokenauth.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_tokenauth.lua b/plugins/mod_tokenauth.lua
index 658aa39d..cb2b63c2 100644
--- a/plugins/mod_tokenauth.lua
+++ b/plugins/mod_tokenauth.lua
@@ -152,17 +152,17 @@ local function _get_validated_grant_info(username, grant)
local password_updated_at = account_info and account_info.password_updated;
local now = os.time();
if password_updated_at and grant.created < password_updated_at then
- module:log("debug", "Token grant issued before last password change, invalidating it now");
+ module:log("debug", "Token grant %s of %s issued before last password change, invalidating it now", grant.id, username);
token_store:set_key(username, grant.id, nil);
return nil, "not-authorized";
elseif grant.expires and grant.expires < now then
- module:log("debug", "Token grant expired, cleaning up");
+ module:log("debug", "Token grant %s of %s expired, cleaning up", grant.id, username);
token_store:set_key(username, grant.id, nil);
return nil, "expired";
end
if not grant.tokens then
- module:log("debug", "Token grant without tokens, cleaning up");
+ module:log("debug", "Token grant %s of %s without tokens, cleaning up", grant.id, username);
token_store:set_key(username, grant.id, nil);
return nil, "invalid";
end
@@ -170,14 +170,14 @@ local function _get_validated_grant_info(username, grant)
local found_expired = false
for secret_hash, token_info in pairs(grant.tokens) do
if token_info.expires and token_info.expires < now then
- module:log("debug", "Token has expired, cleaning it up");
+ module:log("debug", "Token %s of grant %s of %s has expired, cleaning it up", secret_hash:sub(-8), grant.id, username);
grant.tokens[secret_hash] = nil;
found_expired = true;
end
end
if not grant.expires and next(grant.tokens) == nil and grant.accessed + empty_grant_lifetime < now then
- module:log("debug", "Token grant has no tokens, discarding");
+ module:log("debug", "Token %s of %s grant has no tokens, discarding", grant.id, username);
token_store:set_key(username, grant.id, nil);
return nil, "expired";
elseif found_expired then