aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-06-07 12:21:57 +0100
committerMatthew Wild <mwild1@gmail.com>2010-06-07 12:21:57 +0100
commit1357c719b98ae25b8cc593005371d59dc5182c4d (patch)
tree1764ffb1eaed95676cb1191d8cc401e82979b1ff /plugins/mod_saslauth.lua
parent798403ee6857266c11f288946e532a325697bdb4 (diff)
parentd471482a87ac4914c3555f543e4c120bdb15467a (diff)
downloadprosody-1357c719b98ae25b8cc593005371d59dc5182c4d.tar.gz
prosody-1357c719b98ae25b8cc593005371d59dc5182c4d.zip
Merge trunk/MattJ->trunk
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua36
1 files changed, 2 insertions, 34 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index c16a14da..99be8c34 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -16,7 +16,7 @@ local base64 = require "util.encodings".base64;
local nodeprep = require "util.encodings".stringprep.nodeprep;
local datamanager_load = require "util.datamanager".load;
local usermanager_get_provider = require "core.usermanager".get_provider;
-local usermanager_get_supported_methods = require "core.usermanager".get_supported_methods;
+local usermanager_get_sasl_handler = require "core.usermanager".get_sasl_handler;
local usermanager_user_exists = require "core.usermanager".user_exists;
local usermanager_get_password = require "core.usermanager".get_password;
local usermanager_test_password = require "core.usermanager".test_password;
@@ -67,32 +67,6 @@ else
error("Unknown SASL backend");
end
-local getpass_authentication_profile = {
- plain = function(username, realm)
- local prepped_username = nodeprep(username);
- if not prepped_username then
- log("debug", "NODEprep failed on username: %s", username);
- return "", nil;
- end
- local password = usermanager_get_password(prepped_username, realm);
- if not password then
- return "", nil;
- end
- return password, true;
- end
-};
-
-local testpass_authentication_profile = {
- plain_test = function(username, password, realm)
- local prepped_username = nodeprep(username);
- if not prepped_username then
- log("debug", "NODEprep failed on username: %s", username);
- return "", nil;
- end
- return usermanager_test_password(prepped_username, password, realm), true;
- end
-};
-
local anonymous_authentication_profile = {
anonymous = function(username, realm)
return true; -- for normal usage you should always return true here
@@ -195,13 +169,7 @@ module:hook("stream-features", function(event)
if module:get_option("anonymous_login") then
origin.sasl_handler = new_sasl(realm, anonymous_authentication_profile);
else
- if usermanager_get_provider(realm).get_password then
- origin.sasl_handler = new_sasl(realm, getpass_authentication_profile);
- elseif usermanager_get_provider(realm).test_password then
- origin.sasl_handler = new_sasl(realm, testpass_authentication_profile);
- else
- log("warn", "AUTH: Could not load an authentication profile for the given provider.");
- end
+ origin.sasl_handler = usermanager_get_sasl_handler(module.host);
if not (module:get_option("allow_unencrypted_plain_auth")) and not origin.secure then
origin.sasl_handler:forbidden({"PLAIN"});
end