From 401cfa8b846970fb44e78a4db506bca240b9602c Mon Sep 17 00:00:00 2001 From: mountain Date: Wed, 10 Jul 2024 14:55:47 +0900 Subject: [PATCH] =?UTF-8?q?noauth=EB=8C=80=EC=8B=A0=20authtype=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/http_handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/http_handler.go b/server/http_handler.go index bc68394..7c4ae8c 100644 --- a/server/http_handler.go +++ b/server/http_handler.go @@ -153,6 +153,7 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string } var noauth = flagx.Bool("noauth", false, "") +var authtype = flagx.String("auth", "on", "on|off|both") func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { defer func() { @@ -169,7 +170,7 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { }() var userinfo map[string]any - if !*noauth { + if !*noauth && (*authtype == "on" || *authtype == "both") { authheader := r.Header.Get("Authorization") if len(authheader) == 0 { logger.Println("Authorization header is not valid :", authheader)