Put additional headers in conf

This commit is contained in:
Kload 2013-10-16 18:16:41 +02:00
parent c87265f674
commit b7c9e83f90
2 changed files with 14 additions and 5 deletions

View file

@ -137,13 +137,16 @@ function set_headers (user)
end end
end end
ngx.req.set_header("Auth-User", user) -- Set HTTP Auth header
ngx.req.set_header("Remote-User", user)
ngx.req.set_header("Name", cache[user]["cn"])
ngx.req.set_header("Email", cache[user]["mail"])
ngx.req.set_header("Authorization", "Basic "..ngx.encode_base64( ngx.req.set_header("Authorization", "Basic "..ngx.encode_base64(
cache[user]["uid"]..":"..cache[user]["password"] cache[user]["uid"]..":"..cache[user]["password"]
)) ))
-- Set Additional headers
for k, v in pairs(conf["additional_headers"]) do
ngx.req.set_header(k, cache[user][v])
end
end end
function display_login_form () function display_login_form ()

View file

@ -11,5 +11,11 @@
"mydomain.com/megusta", "mydomain.com/megusta",
"myotherdomain.com/somuchwin" "myotherdomain.com/somuchwin"
], ],
"unprotected_urls": ["mydomain.com/yunoprotect"] "unprotected_urls": ["mydomain.com/yunoprotect"],
"additional_headers": {
"Auth-User": "uid",
"Remote-User": "uid",
"Email": "mail",
"Name": "cn"
}
} }