# HG changeset patch # User Matthew Wild # Date 1680705236 -3600 # Node ID 7558fd152459bef3e362fc18510ecdb6dcf9c6aa # Parent cbe58f747d487853a5419b76bd6f119ed45ba1cd 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. diff -r cbe58f747d48 -r 7558fd152459 plugins/mod_tokenauth.lua --- a/plugins/mod_tokenauth.lua Tue Apr 04 08:55:15 2023 +0200 +++ b/plugins/mod_tokenauth.lua Wed Apr 05 15:33:56 2023 +0100 @@ -278,6 +278,13 @@ 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);