diff --git a/builtin/logical/pki/ca_test.go b/builtin/logical/pki/ca_test.go index 2c3339711..9dc418c86 100644 --- a/builtin/logical/pki/ca_test.go +++ b/builtin/logical/pki/ca_test.go @@ -304,6 +304,14 @@ func runSteps(t *testing.T, rootB, intB *backend, client *api.Client, rootName, if path == "issuer/default/json" { // Preserves the new line. expected += "\n" + _, present := resp.Data["issuer_id"] + if !present { + t.Fatalf("expected issuer/default/json to include issuer_id") + } + _, present = resp.Data["issuer_name"] + if !present { + t.Fatalf("expected issuer/default/json to include issuer_name") + } } if diff := deep.Equal(resp.Data["certificate"].(string), expected); diff != nil { t.Fatal(diff) diff --git a/builtin/logical/pki/path_fetch_issuers.go b/builtin/logical/pki/path_fetch_issuers.go index 753058d2e..58a97305f 100644 --- a/builtin/logical/pki/path_fetch_issuers.go +++ b/builtin/logical/pki/path_fetch_issuers.go @@ -841,6 +841,8 @@ func (b *backend) pathGetRawIssuer(ctx context.Context, req *logical.Request, da Data: map[string]interface{}{ "certificate": string(certificate), "ca_chain": issuer.CAChain, + "issuer_id": issuer.ID, + "issuer_name": issuer.Name, }, }, nil } diff --git a/changelog/18482.txt b/changelog/18482.txt new file mode 100644 index 000000000..f51abb675 --- /dev/null +++ b/changelog/18482.txt @@ -0,0 +1,3 @@ +```release-note:improvement +secrets/pki: Return issuer_id and issuer_name on /issuer/:issuer_ref/json endpoint. +```