Browse Source

lowercase to fix tokens with uppercase letters (e.g., slack JWTs)

j8
Scott Boone 4 years ago
parent
commit
e6242f5bc7
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      resources/prosody-plugins/token/util.lib.lua

+ 5
- 6
resources/prosody-plugins/token/util.lib.lua View File

337
         return true;
337
         return true;
338
     end
338
     end
339
 
339
 
340
-    local auth_room = session.jitsi_meet_room;
340
+    local auth_room = string.lower(session.jitsi_meet_room);
341
     if not self.enableDomainVerification then
341
     if not self.enableDomainVerification then
342
         -- if auth_room is missing, this means user is anonymous (no token for
342
         -- if auth_room is missing, this means user is anonymous (no token for
343
         -- its domain) we let it through, jicofo is verifying creation domain
343
         -- its domain) we let it through, jicofo is verifying creation domain
344
-        if auth_room and room ~= string.lower(auth_room) and auth_room ~= '*' then
344
+        if auth_room and room ~= auth_room and auth_room ~= '*' then
345
             return false;
345
             return false;
346
         end
346
         end
347
 
347
 
383
         end
383
         end
384
     end
384
     end
385
 
385
 
386
-    local auth_domain = session.jitsi_meet_domain;
386
+    local auth_domain = string.lower(session.jitsi_meet_domain);
387
     local subdomain_to_check;
387
     local subdomain_to_check;
388
     if target_subdomain then
388
     if target_subdomain then
389
         if auth_domain == '*' then
389
         if auth_domain == '*' then
401
         end
401
         end
402
 
402
 
403
         return room_address_to_verify == jid.join(
403
         return room_address_to_verify == jid.join(
404
-            "["..string.lower(subdomain_to_check).."]"..string.lower(room_to_check), self.muc_domain);
404
+            "["..subdomain_to_check).."]"..room_to_check, self.muc_domain);
405
     else
405
     else
406
         if auth_domain == '*' then
406
         if auth_domain == '*' then
407
             -- check for wildcard in JWT claim, allow access if found
407
             -- check for wildcard in JWT claim, allow access if found
412
         end
412
         end
413
         -- we do not have a domain part (multidomain is not enabled)
413
         -- we do not have a domain part (multidomain is not enabled)
414
         -- verify with info from the token
414
         -- verify with info from the token
415
-        return room_address_to_verify == jid.join(
416
-            string.lower(room_to_check), string.lower(subdomain_to_check));
415
+        return room_address_to_verify == jid.join(room_to_check, subdomain_to_check);
417
     end
416
     end
418
 end
417
 end
419
 
418
 

Loading…
Cancel
Save