+local new_sasl
+if config.get(module:get_host(), "core", "cyrus_service_name") then
+ cyrus_new = require "util.sasl_cyrus".new;
+ new_sasl = function(realm)
+ return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name"))
+ end
+else
+ new_sasl = require "util.sasl".new;
+end
+
+default_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
+};
+
+anonymous_authentication_profile = {
+ anonymous = function(username, realm)
+ return true; -- for normal usage you should always return true here
+ end
+}