allowed to bypass authentication for a specific endpoint to be accessed from ssh client

This commit is contained in:
2025-02-14 12:45:54 +09:00
parent 3dc5d9c91e
commit d5108e9859
2 changed files with 6 additions and 3 deletions

View File

@ -46,6 +46,7 @@ type json_out_server_stats struct {
type server_ctl struct {
s *Server
id string
noauth bool // override the auth configuration if true
}
type server_ctl_token struct {
@ -83,7 +84,7 @@ func (ctl *server_ctl) Cors(req *http.Request) bool {
}
func (ctl *server_ctl) Authenticate(req *http.Request) (int, string) {
if ctl.s.cfg.CtlAuth == nil { return http.StatusOK, "" }
if ctl.noauth || ctl.s.cfg.CtlAuth == nil { return http.StatusOK, "" }
return ctl.s.cfg.CtlAuth.Authenticate(req)
}