mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-21 21:30:48 +02:00
fix: move invalid token to log field (#1171)
* fix: move invalid token to log field * escape invalid token in log field * Update pkg/api/api.go Co-authored-by: Simon Aronsson <simme@arcticbit.se>
This commit is contained in:
parent
04db93c770
commit
be33c64afd
1 changed files with 2 additions and 3 deletions
|
@ -2,8 +2,9 @@ package api
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const tokenMissingMsg = "api token is empty or has not been set. exiting"
|
||||
|
@ -28,8 +29,6 @@ func (api *API) RequireToken(fn http.HandlerFunc) http.HandlerFunc {
|
|||
auth := r.Header.Get("Authorization")
|
||||
want := fmt.Sprintf("Bearer %s", api.Token)
|
||||
if auth != want {
|
||||
log.Tracef("Invalid Authorization header \"%s\"", auth)
|
||||
log.Tracef("Expected Authorization header to be \"%s\"", want)
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue