Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(token_verification): Adds more token failure reasons on verify room. (#16473)
Дамян Минков36ce5a166109
diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.luaindex 6b7f78b3f4..fde69f5b17 100644--- a/resources/prosody-plugins/token/util.lib.lua+++ b/resources/prosody-plugins/token/util.lib.lua@@ -378,14 +378,13 @@ function Util:verify_room(session, room_address)-- extract room name using all chars, except the not allowed oneslocal room,_,_ = jid.split(room_address);if room == nil then- log("error",- "Unable to get name of the MUC room ? to: %s", room_address);- return true;+ module:log('error', 'Unable to get name of the MUC room ? to: %s', room_address);+ return false, 'invalid-room-address', 'Room address is invalid';endlocal room_instance = get_room_from_jid(jid.join(room, self.muc_domain));if not room_instance thenmodule:log('info', 'Room does not exists:%s %s', room, debug.traceback());- return false;+ return false, 'room-does-not-exist', 'Room does not exist';endif self.allowEmptyToken and session.auth_token == nil then@@ -403,11 +402,11 @@ function Util:verify_room(session, room_address)module:log('warn', 'session.jitsi_meet_room not string: %s', inspect(auth_room));endend+if not self.enableDomainVerification then- -- if auth_room is missing, this means user is anonymous (no token for- -- its domain) we let it through, jicofo is verifying creation domain+ -- if auth_room is missing, this means user is anonymous (no token for its domain) we let it throughif auth_room and (room ~= auth_room and not ends_with(room, ']'..auth_room)) and auth_room ~= '*' then- return false;+ return false, 'room-mismatch', 'Room does not match the room from token';endreturn true;@@ -447,7 +446,7 @@ function Util:verify_room(session, room_address)-- not a regexroom_to_check = auth_room;end- -- module:log("debug", "room to check: %s", room_to_check)+if not room_to_check thenif not self.requireRoomClaim then-- if we do not require to have the room claim, and it is missing@@ -455,7 +454,7 @@ function Util:verify_room(session, room_address)return true;end- return false;+ return false, 'room-name-does-not-match', 'Room name cannot be matched to the one from token.';endend@@ -487,7 +486,7 @@ function Util:verify_room(session, room_address)-- deny access if option is missingif not self.muc_domain_base thenmodule:log("warn", "No 'muc_domain_base' option set, denying access!");- return false;+ return false, 'server-missing-config', 'Misconfiguration of server';endreturn room_address_to_verify == jid.join(