mod_auth_*: Use module:provides(), and don't explicitly specify provider.name.

Thu, 13 Sep 2012 00:08:29 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 13 Sep 2012 00:08:29 +0500
changeset 814
881ec9919144
parent 813
2469f779b3f7
child 815
b16b291d68c3

mod_auth_*: Use module:provides(), and don't explicitly specify provider.name.

mod_auth_dovecot/auth_dovecot/mod_auth_dovecot.lua file | annotate | diff | comparison | revisions
mod_auth_external/mod_auth_external.lua file | annotate | diff | comparison | revisions
mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua file | annotate | diff | comparison | revisions
mod_auth_joomla/mod_auth_joomla.lua file | annotate | diff | comparison | revisions
mod_auth_ldap/mod_auth_ldap.lua file | annotate | diff | comparison | revisions
mod_auth_ldap2/mod_auth_ldap.lua file | annotate | diff | comparison | revisions
mod_auth_phpbb3/mod_auth_phpbb3.lua file | annotate | diff | comparison | revisions
mod_auth_sql/mod_auth_sql.lua file | annotate | diff | comparison | revisions
mod_auth_wordpress/mod_auth_wordpress.lua file | annotate | diff | comparison | revisions
--- a/mod_auth_dovecot/auth_dovecot/mod_auth_dovecot.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_dovecot/auth_dovecot/mod_auth_dovecot.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -48,9 +48,7 @@
 	log("debug", "Mechanims found: %s", table.concat(m, ", "));
 end
 
-provider = {
-	name = module.name:gsub("^auth_","");
-};
+provider = {};
 
 function provider.test_password(username, password)
 	return new_sasl(module.host):plain_test(username, password);
@@ -90,5 +88,5 @@
 	provider.get_sasl_handler = nil
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
 
--- a/mod_auth_external/mod_auth_external.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_external/mod_auth_external.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -94,7 +94,7 @@
 end
 
 function new_external_provider(host)
-	local provider = { name = "external" };
+	local provider = {};
 
 	function provider.test_password(username, password)
 		return do_query("auth", username, password);
@@ -142,4 +142,4 @@
 	return provider;
 end
 
-module:add_item("auth-provider", new_external_provider(module.host));
+module:provides("auth", new_external_provider(module.host));
--- a/mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -46,7 +46,7 @@
 local global_yubikey_key = module:get_option_string("yubikey_key");
 
 function new_default_provider(host)
-	local provider = { name = "internal_yubikey" };
+	local provider = {};
 	log("debug", "initializing default authentication provider for host '%s'", host);
 
 	function provider.test_password(username, password)
@@ -121,7 +121,7 @@
 	return provider;
 end
 
-module:add_item("auth-provider", new_default_provider(module.host));
+module:provides("auth", new_default_provider(module.host));
 
 function module.command(arg)
 	local command = arg[1];
--- a/mod_auth_joomla/mod_auth_joomla.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_joomla/mod_auth_joomla.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -104,7 +104,7 @@
 end
 
 
-provider = { name = "joomla" };
+provider = {};
 
 function provider.test_password(username, password)
 	local hash = get_password(username);
@@ -178,5 +178,5 @@
 	return sasl;
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
 
--- a/mod_auth_ldap/mod_auth_ldap.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_ldap/mod_auth_ldap.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -19,7 +19,7 @@
 	end
 end
 
-local provider = { name = "ldap" };
+local provider = {};
 
 local function ldap_filter_escape(s) return (s:gsub("[\\*\\(\\)\\\\%z]", function(c) return ("\\%02x"):format(c:byte()) end)); end
 function provider.test_password(username, password)
@@ -53,4 +53,4 @@
 	return new_sasl(module.host, testpass_authentication_profile);
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
--- a/mod_auth_ldap2/mod_auth_ldap.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_ldap2/mod_auth_ldap.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -20,7 +20,7 @@
     return;
 end
 
-local provider = { name = 'ldap' }
+local provider = {}
 
 function provider.test_password(username, password)
     return ldap.bind(username, password);
@@ -81,4 +81,4 @@
     };
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
--- a/mod_auth_phpbb3/mod_auth_phpbb3.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_phpbb3/mod_auth_phpbb3.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -187,7 +187,7 @@
 end
 
 
-provider = { name = "phpbb3" };
+provider = {};
 
 function provider.test_password(username, password)
 	local hash = get_password(username);
@@ -269,5 +269,5 @@
 	return sasl;
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
 
--- a/mod_auth_sql/mod_auth_sql.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_sql/mod_auth_sql.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -81,7 +81,7 @@
 end
 
 
-provider = { name = "sql" };
+provider = {};
 
 function provider.test_password(username, password)
 	return password and get_password(username) == password;
@@ -114,4 +114,4 @@
 	return new_sasl(module.host, profile);
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
--- a/mod_auth_wordpress/mod_auth_wordpress.lua	Wed Sep 12 23:58:01 2012 +0500
+++ b/mod_auth_wordpress/mod_auth_wordpress.lua	Thu Sep 13 00:08:29 2012 +0500
@@ -176,7 +176,7 @@
 end
 
 
-provider = { name = "wordpress" };
+provider = {};
 
 function provider.test_password(username, password)
 	local hash = get_password(username);
@@ -250,5 +250,5 @@
 	return sasl;
 end
 
-module:add_item("auth-provider", provider);
+module:provides("auth", provider);
 

mercurial