view mod_auth_external/examples/lua/prosody-auth-example.lua @ 1472:d44926f39f00

mod_auth_ha1: Authentication module for 'HA1' hashed credentials in a text file, as used by reTurnServer
author Matthew Wild <mwild1@gmail.com>
date Sat, 26 Jul 2014 21:53:52 +0100
parents b6280e8886f4
children
line wrap: on
line source

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