2020-01-13 20:51:40 +00:00
|
|
|
package acl
|
|
|
|
|
|
|
|
const (
|
|
|
|
WildcardName = "*"
|
|
|
|
)
|
|
|
|
|
2020-07-09 23:38:50 +00:00
|
|
|
// Config encapsulates all of the generic configuration parameters used for
|
2020-01-13 20:51:40 +00:00
|
|
|
// policy parsing and enforcement
|
|
|
|
type Config struct {
|
|
|
|
// WildcardName is the string that represents a request to authorize a wildcard permission
|
|
|
|
WildcardName string
|
|
|
|
|
|
|
|
// embedded enterprise configuration
|
|
|
|
EnterpriseConfig
|
|
|
|
}
|
|
|
|
|
2021-10-27 16:47:57 +00:00
|
|
|
type ExportFetcher interface {
|
|
|
|
// ExportsForPartition returns the config entry defining exports for a partition
|
2021-12-03 06:50:38 +00:00
|
|
|
ExportsForPartition(partition string) ExportedServices
|
2021-10-27 16:47:57 +00:00
|
|
|
}
|
|
|
|
|
2021-12-03 06:50:38 +00:00
|
|
|
type ExportedServices struct {
|
2022-11-09 21:04:17 +00:00
|
|
|
// Data is a map of [namespace] -> [service] -> [list of partitions the service is exported to]
|
|
|
|
// This includes both the names of typical service instances and their corresponding sidecar proxy
|
|
|
|
// instance names. Meaning that if "web" is exported, "web-sidecar-proxy" instances will also be
|
|
|
|
// shown as exported.
|
2021-10-27 16:47:57 +00:00
|
|
|
Data map[string]map[string][]string
|
2021-10-24 22:28:46 +00:00
|
|
|
}
|
|
|
|
|
2020-01-13 20:51:40 +00:00
|
|
|
// GetWildcardName will retrieve the configured wildcard name or provide a default
|
|
|
|
// in the case that the config is Nil or the wildcard name is unset.
|
|
|
|
func (c *Config) GetWildcardName() string {
|
|
|
|
if c == nil || c.WildcardName == "" {
|
|
|
|
return WildcardName
|
|
|
|
}
|
|
|
|
return c.WildcardName
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close will relinquish any resources this Config might be holding on to or
|
|
|
|
// managing.
|
|
|
|
func (c *Config) Close() {
|
|
|
|
if c != nil {
|
|
|
|
c.EnterpriseConfig.Close()
|
|
|
|
}
|
|
|
|
}
|