Fix get all vault token policies

This commit is contained in:
Jorge Marey
2020-04-16 16:38:24 +02:00
parent 417f50f925
commit 8de6c266fa

View File

@@ -1054,15 +1054,7 @@ func (v *vaultClient) LookupToken(ctx context.Context, token string) (*vapi.Secr
// PoliciesFrom parses the set of policies returned by a token lookup.
func PoliciesFrom(s *vapi.Secret) ([]string, error) {
if s == nil {
return nil, fmt.Errorf("cannot parse nil Vault secret")
}
var data tokenData
if err := mapstructure.WeakDecode(s.Data, &data); err != nil {
return nil, fmt.Errorf("failed to parse Vault token's data block: %v", err)
}
return data.Policies, nil
return s.TokenPolicies()
}
// RevokeTokens revokes the passed set of accessors. If committed is set, the