1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-29 01:01:36 +02:00

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

* 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 19:28:56 +01:00
committed by GitHub
parent 487a0a5b99
commit 5d60177d3e
2 changed files with 7 additions and 1 deletions

@ -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 {