From d6aab44beeca8934183915e6b49fc70df8159ce4 Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 9 Mar 2023 15:13:23 +0100 Subject: [PATCH] chore: pass authenticator errors to debug logging level --- internal/auth/middleware.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/auth/middleware.go b/internal/auth/middleware.go index 13e5b60..debbeb6 100644 --- a/internal/auth/middleware.go +++ b/internal/auth/middleware.go @@ -29,10 +29,7 @@ func CtxUser(ctx context.Context) (*User, error) { return user, nil } -var ( - ErrUnauthenticated = errors.New("unauthenticated") - ErrForbidden = errors.New("forbidden") -) +var ErrUnauthenticated = errors.New("unauthenticated") type User interface { Subject() string @@ -55,7 +52,7 @@ func Middleware(authenticators ...Authenticator) func(http.Handler) http.Handler for _, auth := range authenticators { user, err = auth.Authenticate(ctx, r) if err != nil { - logger.Warn(ctx, "could not authenticate request", logger.E(errors.WithStack(err))) + logger.Debug(ctx, "could not authenticate request", logger.E(errors.WithStack(err))) continue }