fix(prosody) fix username not being set in mod_auth_jitsi-anonymous

If the session was not resumed the plugin must generate a random username, just
like the regular anonymous authentication plugin does.
This commit is contained in:
Saúl Ibarra Corretgé 2021-08-18 09:09:18 +02:00 committed by Saúl Ibarra Corretgé
parent 508decc3f3
commit 186125607f
1 changed files with 8 additions and 0 deletions

View File

@ -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;