From 45f5578e4b994d7f73bf36a9371a3f0736519860 Mon Sep 17 00:00:00 2001 From: Bart Jeukendrup Date: Tue, 21 Nov 2023 20:59:13 +0100 Subject: [PATCH] feat: add allowAlways setting for plain proxy capability --- cmd/filter-proxy/main.go | 4 ++++ internal/config/config.go | 1 + 2 files changed, 5 insertions(+) diff --git a/cmd/filter-proxy/main.go b/cmd/filter-proxy/main.go index 87f053a..05b8fcc 100644 --- a/cmd/filter-proxy/main.go +++ b/cmd/filter-proxy/main.go @@ -271,6 +271,10 @@ func main() { } func authorizeRequestWithService(config *config.Config, path config.Path, r *http.Request) (int, *AuthorizationResponse) { + if path.AllowAlways { + return http.StatusOK, nil + } + if config.AuthorizationServiceURL == "" { log.Print("returned unauthenticated as there is no authorization service URL configured.") return http.StatusInternalServerError, nil diff --git a/internal/config/config.go b/internal/config/config.go index 86b75e7..fa74963 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -26,6 +26,7 @@ type Backend struct { type Path struct { Path string `yaml:"path"` AllowedMethods []string `yaml:"allowedMethods"` + AllowAlways bool `yaml:"allowAlways"` Backend struct { Slug string `yaml:"slug"` Path string `yaml:"path"`