internal/logs: make non error conditions less scary in logs

internal/metrics: simplified struct definition with fmt -s.
internal/metrics: added full path to package name.
This commit is contained in:
Bobby DeSimone 2019-06-17 08:40:18 +02:00
parent 2172d64205
commit 4d4293fc46
No known key found for this signature in database
GPG key ID: AEE4CF12FE86D07E
6 changed files with 18 additions and 23 deletions

View file

@ -229,16 +229,13 @@ func isCORSPreflight(r *http.Request) bool {
func (p *Proxy) Proxy(w http.ResponseWriter, r *http.Request) {
if !p.shouldSkipAuthentication(r) {
s, err := p.restStore.LoadSession(r)
if err != nil {
log.FromRequest(r).Debug().Err(err).Msg("proxy: no bearer auth token found")
}
if s == nil {
// if authorization bearer token does not exist or fails, use cookie store
if err != nil || s == nil {
s, err = p.sessionStore.LoadSession(r)
if err != nil {
switch err {
case http.ErrNoCookie, sessions.ErrLifetimeExpired, sessions.ErrInvalidSession:
log.FromRequest(r).Debug().Err(err).Msg("proxy: invalid session")
log.FromRequest(r).Debug().Str("cause", err.Error()).Msg("proxy: invalid session, start auth process")
p.sessionStore.ClearSession(w, r)
p.OAuthStart(w, r)
return