aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl/anonymous.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/sasl/anonymous.lua')
-rw-r--r--util/sasl/anonymous.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/util/sasl/anonymous.lua b/util/sasl/anonymous.lua
index 7b5a5081..ca5fe404 100644
--- a/util/sasl/anonymous.lua
+++ b/util/sasl/anonymous.lua
@@ -16,16 +16,26 @@ local s_match = string.match;
local log = require "util.logger".init("sasl");
local generate_uuid = require "util.uuid".generate;
-module "anonymous"
+module "sasl.anonymous"
--=========================
--SASL ANONYMOUS according to RFC 4505
+
+--[[
+Supported Authentication Backends
+
+anonymous:
+ function(username, realm)
+ return true; --for normal usage just return true; if you don't like the supplied username you can return false.
+ end
+]]
+
local function anonymous(self, message)
local username;
repeat
username = generate_uuid();
- until self.profile.anonymous(username, self.realm);
- self["username"] = username;
+ until self.profile.anonymous(self, username, self.realm);
+ self.username = username;
return "success"
end
@@ -33,4 +43,4 @@ function init(registerMechanism)
registerMechanism("ANONYMOUS", {"anonymous"}, anonymous);
end
-return _M; \ No newline at end of file
+return _M;