# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1680719939 -3600
# Node ID b10a7082b3c3539b0d948a8eab07bc9c69ff839d
# Parent  ba94a53019856f02b8f1573ef28252de507e0ccc
mod_sasl2_fast: Add API method to revoke FAST tokens for a given client

diff -r ba94a5301985 -r b10a7082b3c3 mod_sasl2_fast/mod_sasl2_fast.lua
--- a/mod_sasl2_fast/mod_sasl2_fast.lua	Tue Apr 04 18:09:48 2023 +0100
+++ b/mod_sasl2_fast/mod_sasl2_fast.lua	Wed Apr 05 19:38:59 2023 +0100
@@ -245,3 +245,10 @@
 	end
 	return false;
 end
+
+function revoke_fast_tokens(username, client_id)
+	local client_id_hash = hash.sha256(client_id, true);
+	local cur_ok = token_store:set(username, client_id_hash.."-cur", nil);
+	local new_ok = token_store:set(username, client_id_hash.."-new", nil);
+	return cur_ok and new_ok;
+end