Comparison

plugins/mod_tokenauth.lua @ 12914:2b4661bd39e2

mod_tokenauth: Add some sanity checking of the new optional parameters
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Mar 2023 13:02:51 +0000
parent 12913:012fa81d1f5d
child 12915:70f6a8dceb1d
comparison
equal deleted inserted replaced
12913:012fa81d1f5d 12914:2b4661bd39e2
21 21
22 local token_username, token_host, token_resource = jid.split(token_jid); 22 local token_username, token_host, token_resource = jid.split(token_jid);
23 23
24 if token_host ~= module.host then 24 if token_host ~= module.host then
25 return nil, "invalid-host"; 25 return nil, "invalid-host";
26 end
27
28 if (token_data and type(token_data) ~= "table") or (token_purpose and type(token_purpose ~= "string")) then
29 return nil, "bad-request";
26 end 30 end
27 31
28 local token_info = { 32 local token_info = {
29 owner = actor_jid; 33 owner = actor_jid;
30 created = os.time(); 34 created = os.time();