AuthN: Make logger less noisy (#76044)

* Change to debug for token needs rotation errors
This commit is contained in:
Karl Persson 2023-10-05 16:11:36 +02:00 committed by GitHub
parent 6614eb0a6e
commit 81b366e2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,12 @@ func (s *Service) authenticate(ctx context.Context, c authn.Client, r *authn.Req
r.OrgID = orgIDFromRequest(r)
identity, err := c.Authenticate(ctx, r)
if err != nil {
s.log.FromContext(ctx).Warn("Failed to authenticate request", "client", c.Name(), "error", err)
log := s.log.FromContext(ctx).Warn
if errors.Is(err, authn.ErrTokenNeedsRotation) {
log = s.log.FromContext(ctx).Debug
}
log("Failed to authenticate request", "client", c.Name(), "error", err)
return nil, err
}