func NewAuthValidator(enabled bool, authCli *authorizationv1.AuthorizationV1Client,
	clusterScoped bool, targetNamespace string, enableFilterNamespace bool) *AuthValidator {
	return &AuthValidator{
		enabled:               enabled,
		authCli:               authCli,
		clusterScoped:         clusterScoped,
		targetNamespace:       targetNamespace,
		enableFilterNamespace: enableFilterNamespace,
	}
}
NewAuthValidator returns a new AuthValidator
package webhook
import (
	"context"
	"fmt"
	"net/http"
	"strings"
	authv1 "k8s.io/api/authorization/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	authorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
	ctrl "sigs.k8s.io/controller-runtime"
	"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
	"github.com/chaos-mesh/chaos-mesh/api/v1alpha1"
)
var alwaysAllowedKind = []string{
	v1alpha1.KindAWSChaos,
	v1alpha1.KindPodNetworkChaos,
	v1alpha1.KindPodIOChaos,
	v1alpha1.KindGCPChaos,
	v1alpha1.KindPodHttpChaos,
	v1alpha1.KindPhysicalMachineChaos,
	"WorkflowNode",
}
var authLog = ctrl.Log.WithName("validate-auth")
type AuthValidator struct {
	enabled bool
	authCli *authorizationv1.AuthorizationV1Client
	decoder *admission.Decoder
	clusterScoped         bool
	targetNamespace       string
	enableFilterNamespace bool
}