Using the IPTV Plugin with Stalker (or Any Other HTTP Backend)
Intro
Sometimes you need to use multiple authentication backends, for example Stalker + Flussonic IPTV Plugin.
IPTV Plugin is a special case of authorization backend. You should to configure multiauth to work with two backends.
IPTV Plugin + Stalker
IPTV plugin is a auth backend with the URL: http://127.0.0.1/tv/auth
There is an lua example:
function convert_reply(reply)
if reply.code == 200 then
t = {}
if reply.headers["x-authduration"] then
t["auth_time"] = tonumber(reply.headers["x-authduration"])
end
if reply.headers["x-max-sessions"] then
t["max_sessions"] = tonumber(reply.headers["x-max-sessions"])
end
if reply.headers["x-userid"] then
t["user_id"] = reply.headers["x-userid"]
end
return true, t
else
return false,{["code"] = reply.code}
end
end
reply1 = http.get("http://127.0.0.1/tv/auth?"..http.qs_encode(req))
status1, headers1 = convert_reply(reply1)
if status1 then
return status1, headers1
end
reply2 = http.get("http://<HOST:PORT>/stalker_portal/server/api/chk_flussonic_tmp_link.php?"..http.qs_encode(req))
status2, headers2 = convert_reply(reply2)
return status2, headers2
Save this code to the file: /etc/flussonic/auth.lua
and then configure Flussonic to auth via lua file.
/etc/flussonic/flussonic.conf:
# Global settings:
http 80;
...
auth /etc/flussonic/auth.lua;
# Streams
...