Improve logging when failing to authenticate ssowat cookies

This commit is contained in:
Alexandre Aubin 2021-08-14 21:23:53 +02:00
parent 37b2db471b
commit b28788d708

View file

@ -237,15 +237,23 @@ function refresh_logged_in()
"|"..expireTime.. "|"..expireTime..
"|"..session_key) "|"..session_key)
is_logged_in = hash == authHash is_logged_in = hash == authHash
if not is_logged_in then if is_logged_in then
logger.info("Hash "..authHash.." rejected for "..user.."@"..ngx.var.remote_addr)
else
authUser = user authUser = user
return true
else
failReason = "Hash not matching"
end end
return is_logged_in else
failReason = "No {user}-password entry in cache"
end end
else
failReason = "No session key"
end end
else
failReason = "Cookie expired"
end end
logger.debug("SSOwat cookies rejected for "..user.."@"..ngx.var.remote_addr.." : "..failReason)
return false
end end
-- If client set the `Proxy-Authorization` header before reaching the SSO, -- If client set the `Proxy-Authorization` header before reaching the SSO,