Add initial templating support to Vault credential libraries (#2569) (#2575)

Add initial templating support to Vault credential libraries

This adds support for templating various account and user values into
Vault dynamic credential library POST bodies and GET/POST paths.

It also unifies how parameters are used in grants, with backwards
compatibility.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2022-10-27 09:01:05 -04:00
1 parent b5ef8a516b
commit cede1aec93
25 files changed
+612 -78

No files matched your search

@@ -112,11 +112,19 @@ Such a grant is essentially a full administrator grant for a scope.
A few template possibilities exist, which will at grant evaluation time
substitute the given value into the ID field of the grant string:
- `{{account.id}}`: The substituted value is the account ID associated with the
- `{{.Account.Id}}`: The substituted value is the account ID associated with the
token used to perform the action. As an example,
`id={{account.id}};actions=read,change-password"` is one of Boundary's default
grants to allow users that have authenticated with the Password auth method to
change their own password.
`id={{.Account.Id}};actions=read,change-password"` is one of Boundary's
default grants to allow users that have authenticated with the Password auth
method to change their own password.
- **NOTE**: Prior to Boundary 0.11.1, `{{account.id}}` must be used instead.
Boundary 0.11.1+ changes this for consistency with other places within
Boundary that are gaining templating support, but supports both formats for
backwards compatibility.
- `{{user.id}}`: The substituted value is the user ID associated with the token
- `{{.User.Id}}`: The substituted value is the user ID associated with the token
used to perform the action.
- **NOTE**: Prior to Boundary 0.11.1, `{{user.id}}` must be used instead.
Boundary 0.11.1+ changes this for consistency with other places within
Boundary that are gaining templating support, but supports both formats for
backwards compatibility.
@@ -323,7 +323,7 @@ $ boundary roles add-grants -id <global_anon_listing_id> \
-recovery-config /tmp/recovery.hcl \
-grant 'id=*;type=auth-method;actions=list,authenticate' \
-grant 'id=*;type=scope;actions=list,no-op' \
-grant 'id={{account.id}};actions=read,change-password'
-grant 'id={{.Account.Id}};actions=read,change-password'
$ boundary roles add-principals -id <global_anon_listing_id> \
-recovery-config /tmp/recovery.hcl \
@@ -340,7 +340,7 @@ resource "boundary_role" "global_anon_listing" {
grant_strings = [
"id=*;type=auth-method;actions=list,authenticate",
"id=*;type=scope;actions=list,no-op",
"id={{account.id}};actions=read,change-password"
"id={{.Account.Id}};actions=read,change-password"
]
principal_ids = ["u_anon"]
}
@@ -367,7 +367,7 @@ $ boundary roles add-grants -id <org_anon_listing_id> \
-recovery-config /tmp/recovery.hcl \
-grant 'id=*;type=auth-method;actions=list,authenticate' \
-grant 'type=scope;actions=list' \
-grant 'id={{account.id}};actions=read,change-password'
-grant 'id={{.Account.Id}};actions=read,change-password'
$ boundary roles add-principals -id <org_anon_listing_id> \
-recovery-config /tmp/recovery.hcl \
@@ -384,7 +384,7 @@ resource "boundary_role" "org_anon_listing" {
grant_strings = [
"id=*;type=auth-method;actions=list,authenticate",
"type=scope;actions=list",
"id={{account.id}};actions=read,change-password"
"id={{.Account.Id}};actions=read,change-password"
]
principal_ids = ["u_anon"]
}