Software /
code /
prosody
Diff
plugins/mod_tokenauth.lua @ 13275:5db61e0dfc62
mod_tokenauth: Save grant after removing expired tokens
Ensures the periodic cleanup really does remove expired tokens.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Oct 2023 12:33:55 +0200 |
parent | 13274:ddfe07041fc5 |
child | 13276:c34266c061c9 |
line wrap: on
line diff
--- a/plugins/mod_tokenauth.lua Mon Oct 09 20:31:35 2023 +0200 +++ b/plugins/mod_tokenauth.lua Sat Oct 21 12:33:55 2023 +0200 @@ -167,9 +167,14 @@ return nil, "invalid"; end for secret_hash, token_info in pairs(grant.tokens) do + local found_expired = false if token_info.expires and token_info.expires < now then module:log("debug", "Token has expired, cleaning it up"); grant.tokens[secret_hash] = nil; + found_expired = true; + end + if found_expired then + token_store:set_key(username, grant.id, nil); end end