Allow /api/ routes without WebAuthentication (#2455)

This commit is contained in:
Vincent
2022-09-08 07:46:18 +07:00
committed by GitHub
parent b3b110753f
commit 99e1f10c2e

View File

@@ -15,6 +15,7 @@ package server
import (
"net/http"
"strings"
"github.com/runatlantis/atlantis/server/logging"
"github.com/urfave/negroni"
@@ -46,7 +47,8 @@ func (l *RequestLogger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next
if !l.WebAuthentication ||
r.URL.Path == "/events" ||
r.URL.Path == "/healthz" ||
r.URL.Path == "/status" {
r.URL.Path == "/status" ||
strings.HasPrefix(r.URL.Path, "/api/") {
allowed = true
} else {
user, pass, ok := r.BasicAuth()