aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-03-26 15:53:27 +0100
committerMatthew Wild <mwild1@gmail.com>2023-03-26 15:53:27 +0100
commit295c27aa996abe685e99f3f7e35784a516c3e0a0 (patch)
treed7e87e78eb76885de41678623bb51636263f5c67 /plugins
parenteb45f0fcf8c049c9c78c7d4dd967866baf47f043 (diff)
downloadprosody-295c27aa996abe685e99f3f7e35784a516c3e0a0.tar.gz
prosody-295c27aa996abe685e99f3f7e35784a516c3e0a0.zip
mod_tokenauth: return error if storage of new token fails
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_tokenauth.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_tokenauth.lua b/plugins/mod_tokenauth.lua
index 86f9a3bd..3661d8bf 100644
--- a/plugins/mod_tokenauth.lua
+++ b/plugins/mod_tokenauth.lua
@@ -54,10 +54,13 @@ function create_jid_token(actor_jid, token_jid, token_role, token_ttl, token_dat
local token_secret = random.bytes(18);
local token = "secret-token:"..base64.encode("2;"..token_id..";"..token_secret..";"..jid.join(token_username, token_host));
- token_store:set(token_username, token_id, {
+ local ok, err = token_store:set(token_username, token_id, {
secret_sha256 = hashes.sha256(token_secret, true);
token_info = token_info
});
+ if not ok then
+ return nil, err;
+ end
return token, token_info;
end