Software /
code /
prosody
Diff
plugins/mod_tokenauth.lua @ 13024:7558fd152459
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 Apr 2023 15:33:56 +0100 |
parent | 13010:3e454af3615d |
child | 13073:9e5802b45b9e |
line wrap: on
line diff
--- 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);