aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-04-05 15:33:56 +0100
committerMatthew Wild <mwild1@gmail.com>2023-04-05 15:33:56 +0100
commitfb35ec60a352ab1f34002a0125e5a88770a4edab (patch)
treee03a4c001a9ae90f377c30b0148de42cbe83089b
parente49554a4220ef763bc17f966d27b78f9f581c9d3 (diff)
downloadprosody-fb35ec60a352ab1f34002a0125e5a88770a4edab.tar.gz
prosody-fb35ec60a352ab1f34002a0125e5a88770a4edab.zip
mod_tokenauth: Add API method to revoke a grant by id
We probably want to refactor revoke_token() to use this one in the future.
-rw-r--r--plugins/mod_tokenauth.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_tokenauth.lua b/plugins/mod_tokenauth.lua
index c1fd37a6..1403047b 100644
--- a/plugins/mod_tokenauth.lua
+++ b/plugins/mod_tokenauth.lua
@@ -278,6 +278,13 @@ function revoke_token(token)
return true;
end
+function revoke_grant(username, grant_id)
+ local ok, err = token_store:set_key(username, grant_id, nil);
+ if not ok then return nil, err; end
+ module:fire_event("token-grant-revoked", { id = grant_id, username = username, host = module.host });
+ return true;
+end
+
function sasl_handler(auth_provider, purpose, extra)
return function (sasl, token, realm, _authzid)
local token_info, err = get_token_info(token);