Log the difference between invalid email and not authorized session (#2010)

* Log the difference between invalid email and not authorized session

* Add changelog entry

* Remove superfluous argument

---------

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
This commit is contained in:
Ole-Martin Bratteng
2023-03-05 18:28:56 +00:00
committed by GitHub
co-authored by Joel Speed
parent 487a0a5b99
commit 5d60177d3e
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -1056,7 +1056,12 @@ func (p *OAuthProxy) getAuthenticatedSession(rw http.ResponseWriter, req *http.R
}
if invalidEmail || !authorized {
logger.PrintAuthf(session.Email, req, logger.AuthFailure, "Invalid authorization via session: removing session %s", session)
cause := "unauthorized"
if invalidEmail {
cause = "invalid email"
}
logger.PrintAuthf(session.Email, req, logger.AuthFailure, "Invalid authorization via session (%s): removing session %s", cause, session)
// Invalid session, clear it
err := p.ClearSessionCookie(rw, req)
if err != nil {