From 27481f02705241e5753768c18e8b91437fab3b28 Mon Sep 17 00:00:00 2001 From: Andrei Bora Date: Thu, 27 May 2021 18:58:06 +0300 Subject: [PATCH] Allow both regex and normal check for the room name --- resources/prosody-plugins/token/util.lib.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.lua index c881eae9f..81d8aa7b2 100644 --- a/resources/prosody-plugins/token/util.lib.lua +++ b/resources/prosody-plugins/token/util.lib.lua @@ -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