aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-06-04 18:38:35 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-06-04 18:38:35 +0500
commitbd5eb28b327232a6a016012368905f02a3f3be36 (patch)
tree65f01a2d0266c9db3cd0c715990c59071e8b32f1
parent5f4b882a7769e4468d35930b1b8638824584fdab (diff)
parent3846f08f09defece7a04ef3e68b3843f5a206c08 (diff)
downloadprosody-bd5eb28b327232a6a016012368905f02a3f3be36.tar.gz
prosody-bd5eb28b327232a6a016012368905f02a3f3be36.zip
Merge with trunk.
-rw-r--r--core/modulemanager.lua2
-rw-r--r--core/usermanager.lua12
-rw-r--r--plugins/mod_auth_internal.lua (renamed from plugins/mod_defaultauth.lua)2
-rw-r--r--plugins/mod_auth_internal_hashed.lua (renamed from plugins/mod_hashpassauth.lua)2
4 files changed, 12 insertions, 6 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 2847663c..8e62aecb 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -39,7 +39,7 @@ end
local array, set = require "util.array", require "util.set";
-local autoload_modules = {"presence", "message", "iq", "defaultauth"};
+local autoload_modules = {"presence", "message", "iq"};
-- We need this to let modules access the real global namespace
local _G = _G;
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 6c269401..fe525bc1 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -7,6 +7,7 @@
--
local datamanager = require "util.datamanager";
+local modulemanager = require "core.modulemanager";
local log = require "util.logger".init("usermanager");
local type = type;
local error = error;
@@ -22,6 +23,8 @@ local prosody = _G.prosody;
local setmetatable = setmetatable;
+local default_provider = "internal";
+
module "usermanager"
function new_null_provider()
@@ -33,9 +36,8 @@ local function host_handler(host)
local host_session = hosts[host];
host_session.events.add_handler("item-added/auth-provider", function (event)
local provider = event.item;
- if config.get(host, "core", "authentication") == nil and provider.name == "default" then
- host_session.users = provider;
- elseif config.get(host, "core", "authentication") == provider.name then
+ local auth_provider = config.get(host, "core", "authentication") or default_provider;
+ if provider.name == auth_provider then
host_session.users = provider;
end
if host_session.users ~= nil and host_session.users.name ~= nil then
@@ -49,6 +51,10 @@ local function host_handler(host)
end
end);
host_session.users = new_null_provider(); -- Start with the default usermanager provider
+ local auth_provider = config.get(host, "core", "authentication") or default_provider;
+ if auth_provider ~= "null" then
+ modulemanager.load(host, "auth_"..auth_provider);
+ end
end;
prosody.events.add_handler("host-activated", host_handler, 100);
prosody.events.add_handler("component-activated", host_handler, 100);
diff --git a/plugins/mod_defaultauth.lua b/plugins/mod_auth_internal.lua
index 6782ae09..78a75a1d 100644
--- a/plugins/mod_defaultauth.lua
+++ b/plugins/mod_auth_internal.lua
@@ -23,7 +23,7 @@ local prosody = _G.prosody;
local is_cyrus = usermanager.is_cyrus;
function new_default_provider(host)
- local provider = { name = "default" };
+ local provider = { name = "internal" };
log("debug", "initializing default authentication provider for host '%s'", host);
function provider.test_password(username, password)
diff --git a/plugins/mod_hashpassauth.lua b/plugins/mod_auth_internal_hashed.lua
index bea2c67f..e2c423f2 100644
--- a/plugins/mod_hashpassauth.lua
+++ b/plugins/mod_auth_internal_hashed.lua
@@ -28,7 +28,7 @@ local is_cyrus = usermanager.is_cyrus;
local iteration_count = 4096;
function new_hashpass_provider(host)
- local provider = { name = "hashpass" };
+ local provider = { name = "internal_hashed" };
log("debug", "initializing hashpass authentication provider for host '%s'", host);
function provider.test_password(username, password)