Check if authToken is set
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-02-02 22:09:09 +01:00
parent 1d81510ae0
commit b83b633dd6

View File

@ -1074,7 +1074,7 @@ func main() {
func wrapAuth(handler http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
auth := r.Header.Get("Authorization")
if auth == "" || auth == "Token "+authToken {
if auth == "" || (authToken != "" && auth == "Token "+authToken) {
r = r.WithContext(context.WithValue(r.Context(), authKey, auth != ""))
// auth == "", require cookie in handler
handler.ServeHTTP(w, r)