瀏覽代碼

Allow both regex and normal check for the room name

j8
Andrei Bora 3 年之前
父節點
當前提交
27481f0270
共有 1 個檔案被更改,包括 13 行新增5 行删除
  1. 13
    5
      resources/prosody-plugins/token/util.lib.lua

+ 13
- 5
resources/prosody-plugins/token/util.lib.lua 查看文件

@@ -304,6 +304,9 @@ function Util:process_and_verify_token(session, acceptedIssuers)
304 304
             -- Binds any features details to the session
305 305
             session.jitsi_meet_context_features = claims["context"]["features"];
306 306
           end
307
+          if claims["context"]["room"] ~= nil then
308
+            session.jitsi_meet_context_room = claims["context"]["room"]
309
+          end
307 310
         end
308 311
         return true;
309 312
     else
@@ -370,12 +373,17 @@ function Util:verify_room(session, room_address)
370 373
             room_to_check = room_node;
371 374
         end
372 375
     else
373
-        -- no wildcard, so check room against authorized room regex from the token
374
-        if target_room ~= nil then
375
-            -- room with subdomain
376
-            room_to_check = target_room:match(auth_room);
376
+        -- no wildcard, so check room against authorized room from the token
377
+        if session.jitsi_meet_context_room and (session.jitsi_meet_context_room["regex"] == true or session.jitsi_meet_context_room["regex"] == "true") then
378
+            if target_room ~= nil then
379
+                -- room with subdomain
380
+                room_to_check = target_room:match(auth_room);
381
+            else
382
+                room_to_check = room_node:match(auth_room);
383
+            end
377 384
         else
378
-            room_to_check = room_node:match(auth_room);
385
+            -- not a regex
386
+            room_to_check = auth_room;
379 387
         end
380 388
         module:log("debug", "room to check: %s", room_to_check)
381 389
         if not room_to_check then

Loading…
取消
儲存