浏览代码

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.
master
Saúl Ibarra Corretgé 4 年前
父节点
当前提交
186125607f
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
    0
      resources/prosody-plugins/mod_auth_jitsi-anonymous.lua

+ 8
- 0
resources/prosody-plugins/mod_auth_jitsi-anonymous.lua 查看文件

2
 -- * session resumption
2
 -- * session resumption
3
 -- Copyright (C) 2021-present 8x8, Inc.
3
 -- Copyright (C) 2021-present 8x8, Inc.
4
 
4
 
5
+local generate_random_id = require "util.id".medium;
5
 local new_sasl = require "util.sasl".new;
6
 local new_sasl = require "util.sasl".new;
6
 local sasl = require "util.sasl";
7
 local sasl = require "util.sasl";
7
 local sessions = prosody.full_sessions;
8
 local sessions = prosody.full_sessions;
57
 module:provides("auth", provider);
58
 module:provides("auth", provider);
58
 
59
 
59
 local function anonymous(self, message)
60
 local function anonymous(self, message)
61
+    -- Same as the vanilla anonymous auth plugin
62
+    local username = generate_random_id():lower();
63
+
60
     -- This calls the handler created in 'provider.get_sasl_handler(session)'
64
     -- This calls the handler created in 'provider.get_sasl_handler(session)'
61
     local result, err, msg = self.profile.anonymous(self, username, self.realm);
65
     local result, err, msg = self.profile.anonymous(self, username, self.realm);
62
 
66
 
63
     if result == true then
67
     if result == true then
68
+        if (self.username == nil) then
69
+            -- Session was not resumed
70
+            self.username = username;
71
+        end
64
         return "success";
72
         return "success";
65
     else
73
     else
66
         return "failure", err, msg;
74
         return "failure", err, msg;

正在加载...
取消
保存