diff --git a/internal/proxy/attribute/attribute.go b/internal/proxy/attribute/attribute.go index f84f2733e..69f023035 100644 --- a/internal/proxy/attribute/attribute.go +++ b/internal/proxy/attribute/attribute.go @@ -31,7 +31,7 @@ type Attribute struct { Value string `yaml:"value" mapstructure:"value"` } -func ComposeAttribute(attribute string, attrs map[string]interface{}) string { +func Compose(attribute string, attrs map[string]interface{}) string { if strings.Contains(attribute, "${") { template := fasttemplate.New(attribute, "${", "}") return template.ExecuteString(attrs) diff --git a/internal/proxy/hook/authz/authz.go b/internal/proxy/hook/authz/authz.go index 03fba5a40..479bb3259 100644 --- a/internal/proxy/hook/authz/authz.go +++ b/internal/proxy/hook/authz/authz.go @@ -396,7 +396,7 @@ func getAttributesValues(attributes interface{}) ([]string, error) { func composeResourcesName(resourceList []string, permissionAttributes map[string]interface{}) []string { var resourcesName []string for _, res := range resourceList { - resourcesName = append(resourcesName, proxyattr.ComposeAttribute(res, permissionAttributes)) + resourcesName = append(resourcesName, proxyattr.Compose(res, permissionAttributes)) } return resourcesName } diff --git a/internal/proxy/middleware/authz/authz.go b/internal/proxy/middleware/authz/authz.go index 96021b8ff..4f559f78c 100644 --- a/internal/proxy/middleware/authz/authz.go +++ b/internal/proxy/middleware/authz/authz.go @@ -279,7 +279,7 @@ func (c *Authz) ServeHTTP(rw http.ResponseWriter, req *http.Request) { func (c Authz) preparePermissionResource(ctx context.Context, perm Permission, attrs map[string]interface{}) (resource.Resource, error) { resourceName, ok := attrs[perm.Attribute].(string) if !ok { - resourceName = attribute.ComposeAttribute(perm.Attribute, attrs) + resourceName = attribute.Compose(perm.Attribute, attrs) } res := resource.Resource{