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
changed to using a setter for the asapKeyServer
Aaron van Meerten7ce44f85cae6
diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.luaindex ec962f9f6d..c18bdd4872 100644--- a/resources/prosody-plugins/token/util.lib.lua+++ b/resources/prosody-plugins/token/util.lib.lua@@ -100,13 +100,14 @@ function Util.new(module)return selfend+function Util:set_asap_key_server(asapKeyServer)+ self.asapKeyServer = asapKeyServer+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,asapKeyServer)- if asapKeyServer == "" then- asapKeyServer = self.asapKeyServer)- end+function Util:get_public_key(keyId)local content = cache:get(keyId);if content == nil then-- If the key is not found in the cache.@@ -120,7 +121,7 @@ function Util:get_public_key(keyId,asapKeyServer)enddone();end- local keyurl = path.join(asapKeyServer, hex.to(sha256(keyId))..'.pem');+ local keyurl = path.join(self.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@@ -242,13 +243,6 @@ 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- end-if session.auth_token == nil thenif self.allowEmptyToken thenreturn true;@@ -258,7 +252,7 @@ function Util:process_and_verify_token_with_keyserver(session,asapKeyServer)endlocal pubKey;- if asapKeyServer and session.auth_token ~= nil then+ if self.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)));@@ -266,7 +260,7 @@ function Util:process_and_verify_token_with_keyserver(session,asapKeyServer)if kid == nil thenreturn false, "not-allowed", "'kid' claim is missing";end- pubKey = self:get_public_key(kid,asapKeyServer);+ pubKey = self:get_public_key(kid);if pubKey == nil thenreturn false, "not-allowed", "could not obtain public key";end@@ -274,7 +268,7 @@ function Util:process_and_verify_token_with_keyserver(session,asapKeyServer)-- now verify the whole tokenlocal claims, msg;- if asapKeyServer then+ if self.asapKeyServer thenclaims, msg = self:verify_token(session.auth_token, pubKey);elseclaims, msg = self:verify_token(session.auth_token, self.appSecret);