From 961ff4a3637fd151bbfd90ad1b788ad2bb4f9f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lapeyre?= Date: Wed, 26 Jan 2022 03:59:53 +0100 Subject: [PATCH] Return num_uses during authentication (#12791) * Return num_uses during authentication https://github.com/hashicorp/vault/issues/10664 * Add changelog entry --- changelog/12791.txt | 3 +++ http/logical_test.go | 1 + sdk/logical/translate_response.go | 2 ++ website/content/api-docs/auth/token.mdx | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/12791.txt diff --git a/changelog/12791.txt b/changelog/12791.txt new file mode 100644 index 000000000..1aa881ae8 --- /dev/null +++ b/changelog/12791.txt @@ -0,0 +1,3 @@ +```release-notes:improvemment +core: `num_uses` is now returned during authentication +``` diff --git a/http/logical_test.go b/http/logical_test.go index 05d6bf4ea..2508e27c6 100644 --- a/http/logical_test.go +++ b/http/logical_test.go @@ -224,6 +224,7 @@ func TestLogical_CreateToken(t *testing.T) { "entity_id": "", "token_type": "service", "orphan": false, + "num_uses": json.Number("0"), }, "warnings": nilWarnings, } diff --git a/sdk/logical/translate_response.go b/sdk/logical/translate_response.go index d8642187d..7ecb0d130 100644 --- a/sdk/logical/translate_response.go +++ b/sdk/logical/translate_response.go @@ -39,6 +39,7 @@ func LogicalResponseToHTTPResponse(input *Response) *HTTPResponse { EntityID: input.Auth.EntityID, TokenType: input.Auth.TokenType.String(), Orphan: input.Auth.Orphan, + NumUses: input.Auth.NumUses, } } @@ -108,6 +109,7 @@ type HTTPAuth struct { EntityID string `json:"entity_id"` TokenType string `json:"token_type"` Orphan bool `json:"orphan"` + NumUses int `json:"num_uses"` } type HTTPWrapInfo struct { diff --git a/website/content/api-docs/auth/token.mdx b/website/content/api-docs/auth/token.mdx index ae3f5201c..1abe2cdb2 100644 --- a/website/content/api-docs/auth/token.mdx +++ b/website/content/api-docs/auth/token.mdx @@ -158,7 +158,8 @@ $ curl \ "renewable": true, "entity_id": "", "token_type": "service", - "orphan": false + "orphan": false, + "num_uses": 0 } } ```