FIX: add flag to control whether to check room claim in JWT validation

jibri queue component stop checking room validation in token
Jibri queue component debug output when bad token is found
This commit is contained in:
Aaron van Meerten
2020-08-12 14:43:34 -05:00
parent 3da7798e9f
commit d05fa32413
2 changed files with 22 additions and 10 deletions

View File

@@ -92,6 +92,8 @@ function Util.new(module)
--array of accepted audiences: by default only includes our appId
self.acceptedAudiences = module:get_option_array('asap_accepted_audiences',{'*'})
self.requireRoomClaim = module:get_option_boolean('asap_require_room_claim', true);
if self.asapKeyServer and not have_async then
module:log("error", "requires a version of Prosody with util.async");
return nil;
@@ -112,6 +114,10 @@ function Util:set_asap_accepted_audiences(acceptedAudiences)
self.acceptedAudiences = acceptedAudiences;
end
function Util:set_asap_require_room_claim(checkRoom)
self.requireRoomClaim = checkRoom;
end
--- Returns the public key by keyID
-- @param keyId the key ID to request
-- @return the public key (the content of requested resource) or nil
@@ -222,9 +228,11 @@ function Util:verify_token(token, secret)
return nil, issCheckErr;
end
local roomClaim = claims["room"];
if roomClaim == nil then
return nil, "'room' claim is missing";
if self.requireRoomClaim then
local roomClaim = claims["room"];
if roomClaim == nil then
return nil, "'room' claim is missing";
end
end
local audClaim = claims["aud"];