From b7c9e83f9067f1d4c4d5018ed8d9b87907fd9da3 Mon Sep 17 00:00:00 2001 From: Kload Date: Wed, 16 Oct 2013 18:16:41 +0200 Subject: [PATCH] Put additional headers in conf --- access.lua | 11 +++++++---- conf.json | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/access.lua b/access.lua index c2fb785..dae2aba 100644 --- a/access.lua +++ b/access.lua @@ -137,13 +137,16 @@ function set_headers (user) end end - ngx.req.set_header("Auth-User", user) - ngx.req.set_header("Remote-User", user) - ngx.req.set_header("Name", cache[user]["cn"]) - ngx.req.set_header("Email", cache[user]["mail"]) + -- Set HTTP Auth header ngx.req.set_header("Authorization", "Basic "..ngx.encode_base64( 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 function display_login_form () diff --git a/conf.json b/conf.json index bc252b9..05ea178 100644 --- a/conf.json +++ b/conf.json @@ -11,5 +11,11 @@ "mydomain.com/megusta", "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" + } }