diff --git a/vault/identity_store_aliases_test.go b/vault/identity_store_aliases_test.go index 1cc7c84e68fc..3fce18d180e8 100644 --- a/vault/identity_store_aliases_test.go +++ b/vault/identity_store_aliases_test.go @@ -66,6 +66,19 @@ func TestIdentityStore_CaseInsensitiveEntityAliasName(t *testing.T) { if err != nil || (resp != nil && resp.IsError()) { t.Fatalf("bad: err:%v\nresp: %#v", err, resp) } + + // Ensure that reading the alias returns lower cased alias name + resp, err = i.HandleRequest(ctx, &logical.Request{ + Path: "entity-alias/id/" + aliasID, + Operation: logical.ReadOperation, + }) + if err != nil || (resp != nil && resp.IsError()) { + t.Fatalf("bad: err:%v\nresp: %#v", err, resp) + } + aliasName = resp.Data["name"].(string) + if aliasName != strings.ToLower(testAliasName) { + t.Fatalf("bad alias name; expected: %q, actual: %q", testAliasName, aliasName) + } } // This test is required because MemDB does not take care of ensuring diff --git a/vault/identity_store_group_aliases_test.go b/vault/identity_store_group_aliases_test.go index da725ee1759f..94e8dd311a8e 100644 --- a/vault/identity_store_group_aliases_test.go +++ b/vault/identity_store_group_aliases_test.go @@ -69,6 +69,19 @@ func TestIdentityStore_CaseInsensitiveGroupAliasName(t *testing.T) { if err != nil || (resp != nil && resp.IsError()) { t.Fatalf("bad: err:%v\nresp: %#v", err, resp) } + + // Ensure that reading the alias returns lower cased alias name + resp, err = i.HandleRequest(ctx, &logical.Request{ + Path: "group-alias/id/" + aliasID, + Operation: logical.ReadOperation, + }) + if err != nil || (resp != nil && resp.IsError()) { + t.Fatalf("bad: err:%v\nresp: %#v", err, resp) + } + aliasName = resp.Data["name"].(string) + if aliasName != strings.ToLower(testAliasName) { + t.Fatalf("bad alias name; expected: %q, actual: %q", testAliasName, aliasName) + } } func TestIdentityStore_GroupAliasDeletionOnGroupDeletion(t *testing.T) {