Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jitsi-meet/prosody-plugins/token/util.lib.lua

41 lines
958 B

-- Token authentication
-- Copyright (C) 2015 Atlassian
local jwt = require "luajwtjitsi";
local _M = {};
local function _verify_token(token, appId, appSecret, disableRoomNameConstraints)
local claims, err = jwt.decode(token, appSecret, true);
if claims == nil then
return nil, err;
end
local alg = claims["alg"];
if alg ~= nil and (alg == "none" or alg == "") then
return nil, "'alg' claim must not be empty";
end
local issClaim = claims["iss"];
if issClaim == nil then
return nil, "'iss' claim is missing";
end
if issClaim ~= appId then
return nil, "Invalid application ID('iss' claim)";
end
local roomClaim = claims["room"];
if roomClaim == nil and disableRoomNameConstraints ~= true then
return nil, "'room' claim is missing";
end
return claims;
end
function _M.verify_token(token, appId, appSecret, disableRoomNameConstraints)
return _verify_token(token, appId, appSecret, disableRoomNameConstraints);
end
return _M;