diff --git a/resources/prosody-plugins/mod_auth_jitsi-anonymous.lua b/resources/prosody-plugins/mod_auth_jitsi-anonymous.lua index d222e9cef..c959f96ac 100644 --- a/resources/prosody-plugins/mod_auth_jitsi-anonymous.lua +++ b/resources/prosody-plugins/mod_auth_jitsi-anonymous.lua @@ -2,6 +2,7 @@ -- * session resumption -- Copyright (C) 2021-present 8x8, Inc. +local generate_random_id = require "util.id".medium; local new_sasl = require "util.sasl".new; local sasl = require "util.sasl"; local sessions = prosody.full_sessions; @@ -57,10 +58,17 @@ end module:provides("auth", provider); local function anonymous(self, message) + -- Same as the vanilla anonymous auth plugin + local username = generate_random_id():lower(); + -- This calls the handler created in 'provider.get_sasl_handler(session)' local result, err, msg = self.profile.anonymous(self, username, self.realm); if result == true then + if (self.username == nil) then + -- Session was not resumed + self.username = username; + end return "success"; else return "failure", err, msg;