|
@@ -380,7 +380,7 @@ module:log("info", "Loading jibri_queue_component");
|
380
|
380
|
-- @param group name of the group (optional)
|
381
|
381
|
-- @param session the session to use for storing token specific fields
|
382
|
382
|
-- @return true if values are ok or false otherwise
|
383
|
|
-function verify_token(token, room_name, session)
|
|
383
|
+function verify_token(token, room_jid, session)
|
384
|
384
|
if disableTokenVerification then
|
385
|
385
|
return true;
|
386
|
386
|
end
|
|
@@ -395,22 +395,15 @@ function verify_token(token, room_name, session)
|
395
|
395
|
end
|
396
|
396
|
|
397
|
397
|
session.auth_token = token;
|
398
|
|
- local verified, reason = token_util:process_and_verify_token(session);
|
|
398
|
+ local verified, reason, message = token_util:process_and_verify_token(session);
|
399
|
399
|
if not verified then
|
400
|
|
- log("warn", "not a valid token %s", tostring(reason));
|
|
400
|
+ log("warn", "not a valid token %s: %s", tostring(reason), tostring(message));
|
401
|
401
|
return false;
|
402
|
402
|
end
|
403
|
403
|
|
404
|
|
- local room_address = jid.join(room_name, module:get_host());
|
405
|
|
- -- if there is a group we are in multidomain mode and that group is not
|
406
|
|
- -- our parent host
|
407
|
|
- if group and group ~= "" and group ~= parentHostName then
|
408
|
|
- room_address = "["..group.."]"..room_address;
|
409
|
|
- end
|
410
|
|
-
|
411
|
|
- if not token_util:verify_room(session, room_address) then
|
412
|
|
- log("warn", "Token %s not allowed to join: %s",
|
413
|
|
- tostring(token), tostring(room_address));
|
|
404
|
+ if not token_util:verify_room(session, room_jid) then
|
|
405
|
+ log("warn", "Token %s not allowed to access: %s",
|
|
406
|
+ tostring(token), tostring(room_jid));
|
414
|
407
|
return false;
|
415
|
408
|
end
|
416
|
409
|
|
|
@@ -455,11 +448,13 @@ function handle_update_jibri_queue(event)
|
455
|
448
|
local position = body["position"];
|
456
|
449
|
local requestId = body["requestId"];
|
457
|
450
|
|
458
|
|
- if not verify_token(token, roomAddress, {}) then
|
|
451
|
+ local room_jid = room_jid_match_rewrite(roomAddress);
|
|
452
|
+
|
|
453
|
+ if not verify_token(token, room_jid, {}) then
|
459
|
454
|
return { status_code = 403; };
|
460
|
455
|
end
|
461
|
456
|
|
462
|
|
- local room = get_room_from_jid(room_jid_match_rewrite(roomAddress));
|
|
457
|
+ local room = get_room_from_jid(room_jid);
|
463
|
458
|
if (not room) then
|
464
|
459
|
log("error", "no room found %s", roomAddress);
|
465
|
460
|
return { status_code = 404; };
|