Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Policy custom metadata #12543

Closed
wants to merge 13 commits into from
2 changes: 1 addition & 1 deletion helper/forwarding/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions helper/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ func ToSDKAlias(a *Alias) *logical.Alias {
}

return &logical.Alias{
Name: a.Name,
ID: a.ID,
MountAccessor: a.MountAccessor,
MountType: a.MountType,
Metadata: metadata,
NamespaceID: a.NamespaceID,
Name: a.Name,
ID: a.ID,
MountAccessor: a.MountAccessor,
MountType: a.MountType,
Metadata: metadata,
NamespaceID: a.NamespaceID,
CustomMetadata: a.CustomMetadata,
}
}

Expand Down
2 changes: 1 addition & 1 deletion helper/identity/mfa/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 52 additions & 32 deletions helper/identity/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions helper/identity/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ message Alias {
// NamespaceID is the identifier of the namespace to which this alias
// belongs.
string namespace_id = 11;

// Custom Metadata
map<string, string> customMetadata = 12;
}

// Deprecated. Retained for backwards compatibility.
Expand Down
2 changes: 1 addition & 1 deletion helper/storagepacker/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion physical/raft/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/database/dbplugin/database.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/database/dbplugin/v5/proto/database.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion sdk/helper/identitytpl/templating.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ func performTemplating(input string, p *PopulateStringInput) (string, error) {
case strings.HasPrefix(trimmed, "metadata."):
split := strings.SplitN(trimmed, ".", 2)
return p.templateHandler(alias.Metadata, split[1])

case trimmed == "custom_metadata":
return p.templateHandler(alias.CustomMetadata)

case strings.HasPrefix(trimmed, "custom_metadata."):

split := strings.SplitN(trimmed, ".", 2)
return p.templateHandler(alias.CustomMetadata, split[1])

}

return "", ErrTemplateValueNotFound
Expand Down Expand Up @@ -222,7 +231,7 @@ func performTemplating(input string, p *PopulateStringInput) (string, error) {
}

// An empty alias is sufficient for generating defaults
alias = &logical.Alias{Metadata: make(map[string]string)}
alias = &logical.Alias{Metadata: make(map[string]string), CustomMetadata: make(map[string]string)}
}
return performAliasTemplating(split[1], alias)
}
Expand Down
44 changes: 32 additions & 12 deletions sdk/logical/identity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sdk/logical/identity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ message Alias {
// NamespaceID is the identifier of the namespace to which this alias
// belongs.
string namespace_id = 6;

// Custom Metadata represents the custom data tied to this entity
map<string, string> custom_metadata = 7;
}

message Group {
Expand Down
2 changes: 1 addition & 1 deletion sdk/logical/plugin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/plugin/pb/backend.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vault/activity/activity_log.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.