Allow both regex and normal check for the room name

This commit is contained in:
Andrei Bora 2021-05-27 18:58:06 +03:00 committed by Дамян Минков
parent 724391648e
commit 27481f0270
1 changed files with 13 additions and 5 deletions

View File

@ -304,6 +304,9 @@ function Util:process_and_verify_token(session, acceptedIssuers)
-- Binds any features details to the session
session.jitsi_meet_context_features = claims["context"]["features"];
end
if claims["context"]["room"] ~= nil then
session.jitsi_meet_context_room = claims["context"]["room"]
end
end
return true;
else
@ -370,12 +373,17 @@ function Util:verify_room(session, room_address)
room_to_check = room_node;
end
else
-- no wildcard, so check room against authorized room regex from the token
if target_room ~= nil then
-- room with subdomain
room_to_check = target_room:match(auth_room);
-- no wildcard, so check room against authorized room from the token
if session.jitsi_meet_context_room and (session.jitsi_meet_context_room["regex"] == true or session.jitsi_meet_context_room["regex"] == "true") then
if target_room ~= nil then
-- room with subdomain
room_to_check = target_room:match(auth_room);
else
room_to_check = room_node:match(auth_room);
end
else
room_to_check = room_node:match(auth_room);
-- not a regex
room_to_check = auth_room;
end
module:log("debug", "room to check: %s", room_to_check)
if not room_to_check then