2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 18:39:22 +00:00
|
|
|
|
2021-11-16 18:04:01 +00:00
|
|
|
//go:build !consulent
|
2020-01-29 22:30:38 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package connect
|
|
|
|
|
|
|
|
import (
|
2022-06-10 21:15:22 +00:00
|
|
|
"strings"
|
2021-06-25 21:47:47 +00:00
|
|
|
|
2022-04-05 21:10:06 +00:00
|
|
|
"github.com/hashicorp/consul/acl"
|
2020-01-29 22:30:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// GetEnterpriseMeta will synthesize an EnterpriseMeta struct from the SpiffeIDService.
|
2023-08-22 14:46:03 +00:00
|
|
|
// in CE this just returns an empty (but never nil) struct pointer
|
2022-04-05 21:10:06 +00:00
|
|
|
func (id SpiffeIDService) GetEnterpriseMeta() *acl.EnterpriseMeta {
|
|
|
|
return &acl.EnterpriseMeta{}
|
2020-01-29 22:30:38 +00:00
|
|
|
}
|
2021-06-25 21:47:47 +00:00
|
|
|
|
2023-08-22 14:46:03 +00:00
|
|
|
// PartitionOrDefault breaks from CE's pattern of returning empty strings.
|
|
|
|
// Although CE has no support for partitions, it still needs to be able to
|
2022-06-10 21:15:22 +00:00
|
|
|
// handle exportedPartition from peered Consul Enterprise clusters in order
|
|
|
|
// to generate the correct SpiffeID.
|
|
|
|
func (id SpiffeIDService) PartitionOrDefault() string {
|
|
|
|
if id.Partition == "" {
|
|
|
|
return "default"
|
|
|
|
}
|
|
|
|
|
|
|
|
return strings.ToLower(id.Partition)
|
2021-06-25 21:47:47 +00:00
|
|
|
}
|