Backport of Stop JWT provider from being written in non default namespace into release/1.16.x (#18331)

backport of commit f15be60e48

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
pull/18332/head
hc-github-team-consul-core 1 year ago committed by GitHub
parent 299522b46f
commit 02b33a6d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
```release-note:bug
mesh: **(Enterprise Only)** Require that `jwt-provider` config entries are created in the `default` namespace.
```

@ -509,7 +509,7 @@ func (e *JWTProviderConfigEntry) Validate() error {
return err
}
if err := e.validatePartition(); err != nil {
if err := e.validatePartitionAndNamespace(); err != nil {
return err
}

@ -12,9 +12,14 @@ import (
"github.com/hashicorp/consul/acl"
)
func (e *JWTProviderConfigEntry) validatePartition() error {
func (e *JWTProviderConfigEntry) validatePartitionAndNamespace() error {
if !acl.IsDefaultPartition(e.PartitionOrDefault()) {
return fmt.Errorf("Partitions are an enterprise only feature")
}
if acl.DefaultNamespaceName != e.NamespaceOrDefault() {
return fmt.Errorf("Namespaces are an enterprise only feature")
}
return nil
}

Loading…
Cancel
Save