Allow Basic-Auth pass-through
This commit is contained in:
parent
b8ab3b9dac
commit
a77f1b91ae
2 changed files with 8 additions and 1 deletions
|
@ -132,6 +132,7 @@ function Handler.checkrestricted(self, request)
|
||||||
end
|
end
|
||||||
|
|
||||||
if stat then
|
if stat then
|
||||||
|
request.env.HTTP_AUTH_USER, request.env.HTTP_AUTH_PASS = user, pass
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -258,7 +258,7 @@ function dispatch(request)
|
||||||
local verifytoken = false
|
local verifytoken = false
|
||||||
if not sess then
|
if not sess then
|
||||||
sess = luci.http.getcookie("sysauth")
|
sess = luci.http.getcookie("sysauth")
|
||||||
sess = sess and sess:match("^[a-f0-9]+$")
|
sess = sess and sess:match("^[a-f0-9]*$")
|
||||||
verifytoken = true
|
verifytoken = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -272,6 +272,12 @@ function dispatch(request)
|
||||||
if not verifytoken or ctx.urltoken.stok == sdat.token then
|
if not verifytoken or ctx.urltoken.stok == sdat.token then
|
||||||
user = sdat.user
|
user = sdat.user
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
local eu = http.getenv("HTTP_AUTH_USER")
|
||||||
|
local ep = http.getenv("HTTP_AUTH_PASS")
|
||||||
|
if eu and ep and luci.sys.user.checkpasswd(eu, ep) then
|
||||||
|
authen = function() return eu end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not util.contains(accs, user) then
|
if not util.contains(accs, user) then
|
||||||
|
|
Loading…
Reference in a new issue