add service option for plugin

This commit is contained in:
ginuerzh
2025-08-29 23:34:23 +08:00
parent a12ed27dfa
commit c7d16962ec
71 changed files with 227 additions and 88 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ func NewService(network, addr string, opts ...Option) (service.Service, error) {
mux.Handle(options.path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if options.auther != nil {
u, p, _ := r.BasicAuth()
if _, ok := options.auther.Authenticate(r.Context(), u, p); !ok {
if _, ok := options.auther.Authenticate(r.Context(), u, p, auth.WithService("@metrics")); !ok {
w.WriteHeader(http.StatusUnauthorized)
return
}