瀏覽代碼

supports a '*' in the sub claim to allow access to any room

master
Aaron van Meerten 6 年之前
父節點
當前提交
13165990fc
共有 1 個檔案被更改,包括 18 行新增2 行删除
  1. 18
    2
      resources/prosody-plugins/token/util.lib.lua

+ 18
- 2
resources/prosody-plugins/token/util.lib.lua 查看文件

357
             room_to_check = room_node;
357
             room_to_check = room_node;
358
         end
358
         end
359
     else
359
     else
360
+        -- no wildcard, so check room against authorized room in token
360
         room_to_check = auth_room;
361
         room_to_check = auth_room;
361
     end
362
     end
362
 
363
 
363
     local auth_domain = session.jitsi_meet_domain;
364
     local auth_domain = session.jitsi_meet_domain;
365
+    local subdomain_to_check;
364
     if target_subdomain then
366
     if target_subdomain then
367
+        if auth_domain == '*' then
368
+            -- check for wildcard in JWT claim, allow access if found
369
+            subdomain_to_check = target_subdomain;
370
+        else
371
+            -- no wildcard in JWT claim, so check subdomain against sub in token
372
+            subdomain_to_check = auth_domain;
373
+        end
365
         -- from this point we depend on muc_domain_base,
374
         -- from this point we depend on muc_domain_base,
366
         -- deny access if option is missing
375
         -- deny access if option is missing
367
         if not self.muc_domain_base then
376
         if not self.muc_domain_base then
370
         end
379
         end
371
 
380
 
372
         return room_address_to_verify == jid.join(
381
         return room_address_to_verify == jid.join(
373
-            "["..auth_domain.."]"..string.lower(room_to_check), self.muc_domain);
382
+            "["..subdomain_to_check.."]"..string.lower(room_to_check), self.muc_domain);
374
     else
383
     else
384
+        if auth_domain == '*' then
385
+            -- check for wildcard in JWT claim, allow access if found
386
+            subdomain_to_check = self.muc_domain;
387
+        else
388
+            -- no wildcard in JWT claim, so check subdomain against sub in token
389
+            subdomain_to_check = self.muc_domain_prefix.."."..auth_domain;
390
+        end
375
         -- we do not have a domain part (multidomain is not enabled)
391
         -- we do not have a domain part (multidomain is not enabled)
376
         -- verify with info from the token
392
         -- verify with info from the token
377
         return room_address_to_verify == jid.join(
393
         return room_address_to_verify == jid.join(
378
-            string.lower(room_to_check), self.muc_domain_prefix.."."..auth_domain);
394
+            string.lower(room_to_check), subdomain_to_check);
379
     end
395
     end
380
 end
396
 end
381
 
397
 

Loading…
取消
儲存