Return num_uses during authentication (#12791)

* Return num_uses during authentication

https://github.com/hashicorp/vault/issues/10664

* Add changelog entry
This commit is contained in:
Rémi Lapeyre 2022-01-26 03:59:53 +01:00 committed by GitHub
parent 0e1424782b
commit 961ff4a363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 1 deletions

3
changelog/12791.txt Normal file
View File

@ -0,0 +1,3 @@
```release-notes:improvemment
core: `num_uses` is now returned during authentication
```

View File

@ -224,6 +224,7 @@ func TestLogical_CreateToken(t *testing.T) {
"entity_id": "", "entity_id": "",
"token_type": "service", "token_type": "service",
"orphan": false, "orphan": false,
"num_uses": json.Number("0"),
}, },
"warnings": nilWarnings, "warnings": nilWarnings,
} }

View File

@ -39,6 +39,7 @@ func LogicalResponseToHTTPResponse(input *Response) *HTTPResponse {
EntityID: input.Auth.EntityID, EntityID: input.Auth.EntityID,
TokenType: input.Auth.TokenType.String(), TokenType: input.Auth.TokenType.String(),
Orphan: input.Auth.Orphan, Orphan: input.Auth.Orphan,
NumUses: input.Auth.NumUses,
} }
} }
@ -108,6 +109,7 @@ type HTTPAuth struct {
EntityID string `json:"entity_id"` EntityID string `json:"entity_id"`
TokenType string `json:"token_type"` TokenType string `json:"token_type"`
Orphan bool `json:"orphan"` Orphan bool `json:"orphan"`
NumUses int `json:"num_uses"`
} }
type HTTPWrapInfo struct { type HTTPWrapInfo struct {

View File

@ -158,7 +158,8 @@ $ curl \
"renewable": true, "renewable": true,
"entity_id": "", "entity_id": "",
"token_type": "service", "token_type": "service",
"orphan": false "orphan": false,
"num_uses": 0
} }
} }
``` ```