Compare commits

...

2 Commits

View File

@ -153,6 +153,7 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string
} }
var noauth = flagx.Bool("noauth", false, "") 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) { func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() { defer func() {
@ -169,7 +170,7 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}() }()
var userinfo map[string]any var userinfo map[string]any
if !*noauth { if !*noauth && (*authtype == "on" || *authtype == "both") {
authheader := r.Header.Get("Authorization") authheader := r.Header.Get("Authorization")
if len(authheader) == 0 { if len(authheader) == 0 {
logger.Println("Authorization header is not valid :", authheader) logger.Println("Authorization header is not valid :", authheader)