Changeset

12772:daa654dbd8de

mod_tokenauth: Allow attaching an arbitrary data table to a token
author Matthew Wild <mwild1@gmail.com>
date Thu, 13 Oct 2022 22:46:19 +0100
parents 12771:e9fcc69ea508
children 12773:f100c1035576
files plugins/mod_tokenauth.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_tokenauth.lua	Thu Oct 13 09:55:36 2022 +0100
+++ b/plugins/mod_tokenauth.lua	Thu Oct 13 22:46:19 2022 +0100
@@ -13,7 +13,7 @@
 	return usermanager.get_user_role(username, host);
 end
 
-function create_jid_token(actor_jid, token_jid, token_role, token_ttl)
+function create_jid_token(actor_jid, token_jid, token_role, token_ttl, token_data)
 	token_jid = jid.prep(token_jid);
 	if not actor_jid or token_jid ~= actor_jid and not jid.compare(token_jid, actor_jid) then
 		return nil, "not-authorized";
@@ -33,6 +33,7 @@
 
 		resource = token_resource;
 		role = token_role;
+		data = token_data;
 	};
 
 	local token_id = id.long();