Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
allows override of asap key server in token utility
Aaron van Meerten41e0d782cefc
diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.luaindex a949814ad7..ec962f9f6d 100644--- a/resources/prosody-plugins/token/util.lib.lua+++ b/resources/prosody-plugins/token/util.lib.lua@@ -103,7 +103,10 @@ 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-function Util:get_public_key(keyId)+function Util:get_public_key(keyId,asapKeyServer)+ if asapKeyServer == "" then+ asapKeyServer = self.asapKeyServer)+ endlocal content = cache:get(keyId);if content == nil then-- If the key is not found in the cache.@@ -117,7 +120,7 @@ function Util:get_public_key(keyId)enddone();end- local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem');+ local keyurl = path.join(asapKeyServer, hex.to(sha256(keyId))..'.pem');module:log("debug", "Fetching public key from: "..keyurl);-- We hash the key ID to work around some legacy behavior and make@@ -239,6 +242,12 @@ end-- @param session the current session-- @return false and errorfunction Util:process_and_verify_token(session)+ return self:process_and_verify_token_with_keyserver(session,"")+end+function Util:process_and_verify_token_with_keyserver(session,asapKeyServer)+ if asapKeyServer == "" then+ asapKeyServer = self.asapKeyServer+ endif session.auth_token == nil thenif self.allowEmptyToken then@@ -249,7 +258,7 @@ function Util:process_and_verify_token(session)endlocal pubKey;- if self.asapKeyServer and session.auth_token ~= nil then+ if asapKeyServer and session.auth_token ~= nil thenlocal dotFirst = session.auth_token:find("%.");if not dotFirst then return nil, "Invalid token" endlocal header = json.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)));@@ -257,7 +266,7 @@ function Util:process_and_verify_token(session)if kid == nil thenreturn false, "not-allowed", "'kid' claim is missing";end- pubKey = self:get_public_key(kid);+ pubKey = self:get_public_key(kid,asapKeyServer);if pubKey == nil thenreturn false, "not-allowed", "could not obtain public key";end@@ -265,7 +274,7 @@ function Util:process_and_verify_token(session)-- now verify the whole tokenlocal claims, msg;- if self.asapKeyServer then+ if asapKeyServer thenclaims, msg = self:verify_token(session.auth_token, pubKey);elseclaims, msg = self:verify_token(session.auth_token, self.appSecret);