aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJeff Mitchell <jeff@jefferai.org>2010-05-20 18:06:21 -0400
committerJeff Mitchell <jeff@jefferai.org>2010-05-20 18:06:21 -0400
commit753e5f839b606fd3992678d5d7bb7d2916040e86 (patch)
tree5b7f52abf9c3ac3964c91625b477bb179a4938ef /plugins
parent35157928fba9e8b389bd07fa2f91b70105d053c6 (diff)
downloadprosody-753e5f839b606fd3992678d5d7bb7d2916040e86.tar.gz
prosody-753e5f839b606fd3992678d5d7bb7d2916040e86.zip
Working defaultauth
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_defaultauth.lua (renamed from plugins/mod_auth_default.lua)14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/mod_auth_default.lua b/plugins/mod_defaultauth.lua
index 6151b6c1..6782ae09 100644
--- a/plugins/mod_auth_default.lua
+++ b/plugins/mod_defaultauth.lua
@@ -15,15 +15,19 @@ local ipairs = ipairs;
local hashes = require "util.hashes";
local jid_bare = require "util.jid".bare;
local config = require "core.configmanager";
+local usermanager = require "core.usermanager";
local hosts = hosts;
local prosody = _G.prosody;
+local is_cyrus = usermanager.is_cyrus;
+
function new_default_provider(host)
local provider = { name = "default" };
-
+ log("debug", "initializing default authentication provider for host '%s'", host);
+
function provider.test_password(username, password)
- log("debug", "test password for user %s at host %s", username, host);
+ log("debug", "test password '%s' for user %s at host %s", password, username, module.host);
if is_cyrus(host) then return nil, "Legacy auth not supported with Cyrus SASL."; end
local credentials = datamanager.load(username, host, "accounts") or {};
@@ -35,7 +39,7 @@ function new_default_provider(host)
end
function provider.get_password(username)
- log("debug", "get password for user %s at host %s", username, host);
+ log("debug", "get_password for username '%s' at host '%s'", username, module.host);
if is_cyrus(host) then return nil, "Passwords unavailable for Cyrus SASL."; end
return (datamanager.load(username, host, "accounts") or {}).password;
end
@@ -54,11 +58,11 @@ function new_default_provider(host)
if is_cyrus(host) then return true; end
local account = datamanager.load(username, host, "accounts");
if not account then
- log("debug", "account not found for username '%s' at host '%s'", username, host);
+ log("debug", "account not found for username '%s' at host '%s'", username, module.host);
return nil, "Auth failed. Invalid username";
end
if account.password == nil or string.len(account.password) == 0 then
- log("debug", "account password not set or zero-length for username '%s' at host '%s'", username, host);
+ log("debug", "account password not set or zero-length for username '%s' at host '%s'", username, module.host);
return nil, "Auth failed. Password invalid.";
end
return true;