Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fires event before setting username, allows listeners to override it.

damenchocc79b073f0f0
diff --git a/resources/prosody-plugins/mod_auth_token.lua b/resources/prosody-plugins/mod_auth_token.lua
index fd9b264e7d..94b065eafc 100644
--- a/resources/prosody-plugins/mod_auth_token.lua
+++ b/resources/prosody-plugins/mod_auth_token.lua
@@ -58,7 +58,18 @@ end
function provider.get_sasl_handler(session)
local function get_username_from_token(self, message)
- return token_util:process_and_verify_token(session);
+ local res = token_util:process_and_verify_token(session);
+
+ local customUsername
+ = prosody.events.fire_event("pre-jitsi-authentication", session);
+
+ if (customUsername) then
+ self.username = customUsername;
+ else
+ self.username = message;
+ end
+
+ return res;
end
return new_sasl(host, { anonymous = get_username_from_token });
@@ -73,8 +84,6 @@ local function anonymous(self, message)
-- This calls the handler created in 'provider.get_sasl_handler(session)'
local result, err, msg = self.profile.anonymous(self, username, self.realm);
- self.username = username;
-
if result == true then
return "success";
else