util.stanza: Iterate on childtags instead of all childs.
[prosody.git] / util / sasl / anonymous.lua
index 8f2a7708fd8fd417f888c9cfc9b8fc1cca385c0b..6e6f0949414b86d47ddf55794f0b4144aa64e0f0 100644 (file)
@@ -1,5 +1,5 @@
 -- sasl.lua v0.4
--- Copyright (C) 2008-2009 Tobias Markmann
+-- Copyright (C) 2008-2010 Tobias Markmann
 --
 --    All rights reserved.
 --
 local s_match = string.match;
 
 local log = require "util.logger".init("sasl");
+local generate_uuid = require "util.uuid".generate;
 
 module "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;
+       self.username = username;
        return "success"
 end