Comparison

plugins/mod_tokenauth.lua @ 12917:e4de42495fb7

mod_tokenauth: Gracefully handle missing tokens
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Mar 2023 18:43:54 +0000
parent 12915:70f6a8dceb1d
child 12919:7c0e5c7eff7c
comparison
equal deleted inserted replaced
12916:5a06d07596f9 12917:e4de42495fb7
47 47
48 return token, token_info; 48 return token, token_info;
49 end 49 end
50 50
51 local function parse_token(encoded_token) 51 local function parse_token(encoded_token)
52 if not encoded_token then return nil; end
52 local token = base64.decode(encoded_token); 53 local token = base64.decode(encoded_token);
53 if not token then return nil; end 54 if not token then return nil; end
54 local token_jid, token_id = token:match("^1;([^;]+);(.+)$"); 55 local token_jid, token_id = token:match("^1;([^;]+);(.+)$");
55 if not token_jid then return nil; end 56 if not token_jid then return nil; end
56 local token_user, token_host = jid.split(token_jid); 57 local token_user, token_host = jid.split(token_jid);