diff mod_auth_external_insecure/examples/lua/prosody-auth-example.lua @ 3884:f84ede3e9e3b

mod_auth_external->mod_auth_external_insecure: Unmaintained and almost certainly insecure, discourage its use
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Feb 2020 21:03:17 +0000
parents mod_auth_external/examples/lua/prosody-auth-example.lua@b6280e8886f4
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_auth_external_insecure/examples/lua/prosody-auth-example.lua	Thu Feb 06 21:03:17 2020 +0000
@@ -0,0 +1,13 @@
+local actions = {};
+
+function actions.auth(data)
+	local user, host, pass = data:match("^([^:]+):([^:]+):(.+)$");
+	if user == "someone" then
+		return "1";
+	end
+end
+
+for line in io.lines() do
+	local action, data = line:match("^([^:]+)(.*)$");
+	print(actions[action] and actions[action](data) or "0");
+end