Add templating coalesce function (#4492)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2024-03-15 10:33:10 -04:00
1 parent 7105270cd5
commit 4542eef22b
8 files changed
+52 -8

No files matched your search

@@ -1345,6 +1345,17 @@ func TestRepository_sshCertIssuingCredentialLibrary_retrieveCredential(t *testin
opts: []Option{WithKeyType(KeyTypeEcdsa), WithKeyBits(256)},
retOpts: []credential.Option{credential.WithTemplateData(template.Data{Account: template.Account{Email: util.Pointer("rise-of-the-template@foobar.com")}})},
},
{
name: "vault issue ec(256) cert with coalesce username",
username: `{{coalesce .Account.LoginName .Account.Name .Account.Email}}`,
expected: map[string]any{
"username": "name-that-name",
"valid_principals": []string{"name-that-name"},
},
vaulthPath: "ssh/issue/boundary",
opts: []Option{WithKeyType(KeyTypeEcdsa), WithKeyBits(256)},
retOpts: []credential.Option{credential.WithTemplateData(template.Data{Account: template.Account{Name: util.Pointer("name-that-name"), LoginName: util.Pointer(""), Email: util.Pointer("rise-of-the-template@foobar.com")}})},
},
{
name: "vault issue ec(384) cert with disallowed extension",
username: "username-10-because-789",