Mercurial > prosody-hg
diff plugins/mod_auth_cyrus.lua @ 5115:3939960b3c07
mod_auth_{internal_plain,cyrus,anonymous}: Get rid of useless wrapper function new_default_provider.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 12 Sep 2012 21:32:12 +0500 |
| parents | 58c9519dc461 |
| children | 2c7e1ce8f482 |
line wrap: on
line diff
--- a/plugins/mod_auth_cyrus.lua Wed Sep 05 16:51:16 2012 +0200 +++ b/plugins/mod_auth_cyrus.lua Wed Sep 12 21:32:12 2012 +0500 @@ -41,45 +41,44 @@ end end -function new_default_provider(host) - local provider = { name = "cyrus" }; - log("debug", "initializing default authentication provider for host '%s'", host); - - function provider.test_password(username, password) - return nil, "Legacy auth not supported with Cyrus SASL."; - end +local host = module.host; - function provider.get_password(username) - return nil, "Passwords unavailable for Cyrus SASL."; - end - - function provider.set_password(username, password) - return nil, "Passwords unavailable for Cyrus SASL."; - end +-- define auth provider +local provider = { name = "cyrus" }; +log("debug", "initializing default authentication provider for host '%s'", host); - function provider.user_exists(username) - if require_provisioning then - return usermanager_user_exists(username, module.host); - end - return true; - end - - function provider.create_user(username, password) - return nil, "Account creation/modification not available with Cyrus SASL."; - end +function provider.test_password(username, password) + return nil, "Legacy auth not supported with Cyrus SASL."; +end - function provider.get_sasl_handler() - local handler = new_sasl(module.host); - if require_provisioning then - function handler.require_provisioning(username) - return usermanager_user_exists(username, module.host); - end - end - return handler; - end +function provider.get_password(username) + return nil, "Passwords unavailable for Cyrus SASL."; +end - return provider; +function provider.set_password(username, password) + return nil, "Passwords unavailable for Cyrus SASL."; end -module:add_item("auth-provider", new_default_provider(module.host)); +function provider.user_exists(username) + if require_provisioning then + return usermanager_user_exists(username, host); + end + return true; +end + +function provider.create_user(username, password) + return nil, "Account creation/modification not available with Cyrus SASL."; +end +function provider.get_sasl_handler() + local handler = new_sasl(host); + if require_provisioning then + function handler.require_provisioning(username) + return usermanager_user_exists(username, host); + end + end + return handler; +end + +module:add_item("auth-provider", provider); +
