Browse Source

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 years ago
parent
commit
186125607f
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      resources/prosody-plugins/mod_auth_jitsi-anonymous.lua

+ 8
- 0
resources/prosody-plugins/mod_auth_jitsi-anonymous.lua View File

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

Loading…
Cancel
Save