mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 20:36:26 +02:00
When using tokenutil, return []string not nil for empty slices (#7019)
This conveys type information instead of being a JSON null.
This commit is contained in:
parent
d5e86f35d9
commit
46ce1bedd3
@ -172,7 +172,7 @@ func (b *backend) pathUserRead(ctx context.Context, req *logical.Request, d *fra
|
||||
data["max_ttl"] = int64(user.MaxTTL.Seconds())
|
||||
}
|
||||
if len(user.Policies) > 0 {
|
||||
data["policies"] = user.Policies
|
||||
data["policies"] = data["token_policies"]
|
||||
}
|
||||
if len(user.BoundCIDRs) > 0 {
|
||||
data["bound_cidrs"] = user.BoundCIDRs
|
||||
|
||||
@ -212,6 +212,14 @@ func (t *TokenParams) PopulateTokenData(m map[string]interface{}) {
|
||||
m["token_type"] = t.TokenType.String()
|
||||
m["token_ttl"] = int64(t.TokenTTL.Seconds())
|
||||
m["token_num_uses"] = t.TokenNumUses
|
||||
|
||||
if len(t.TokenPolicies) == 0 {
|
||||
m["token_policies"] = []string{}
|
||||
}
|
||||
|
||||
if len(t.TokenBoundCIDRs) == 0 {
|
||||
m["token_bound_cidrs"] = []string{}
|
||||
}
|
||||
}
|
||||
|
||||
// PopulateTokenAuth populates Auth with parameters
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user