mod_sasl2_fast: Add API method to revoke FAST tokens for a given client
authorMatthew Wild <mwild1@gmail.com>
Wed, 05 Apr 2023 19:38:59 +0100
changeset 5307 b10a7082b3c3
parent 5306 ba94a5301985
child 5308 717ff9468464
mod_sasl2_fast: Add API method to revoke FAST tokens for a given client
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