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:
parent
508decc3f3
commit
186125607f
|
@ -2,6 +2,7 @@
|
||||||
-- * session resumption
|
-- * session resumption
|
||||||
-- Copyright (C) 2021-present 8x8, Inc.
|
-- Copyright (C) 2021-present 8x8, Inc.
|
||||||
|
|
||||||
|
local generate_random_id = require "util.id".medium;
|
||||||
local new_sasl = require "util.sasl".new;
|
local new_sasl = require "util.sasl".new;
|
||||||
local sasl = require "util.sasl";
|
local sasl = require "util.sasl";
|
||||||
local sessions = prosody.full_sessions;
|
local sessions = prosody.full_sessions;
|
||||||
|
@ -57,10 +58,17 @@ end
|
||||||
module:provides("auth", provider);
|
module:provides("auth", provider);
|
||||||
|
|
||||||
local function anonymous(self, message)
|
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)'
|
-- This calls the handler created in 'provider.get_sasl_handler(session)'
|
||||||
local result, err, msg = self.profile.anonymous(self, username, self.realm);
|
local result, err, msg = self.profile.anonymous(self, username, self.realm);
|
||||||
|
|
||||||
if result == true then
|
if result == true then
|
||||||
|
if (self.username == nil) then
|
||||||
|
-- Session was not resumed
|
||||||
|
self.username = username;
|
||||||
|
end
|
||||||
return "success";
|
return "success";
|
||||||
else
|
else
|
||||||
return "failure", err, msg;
|
return "failure", err, msg;
|
||||||
|
|
Loading…
Reference in New Issue