mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-04 22:32:09 -04:00
Use role's allowed policies if none are given
This commit is contained in:
parent
6a01943755
commit
12f58773fe
1 changed files with 6 additions and 2 deletions
|
|
@ -749,8 +749,12 @@ func (ts *TokenStore) handleCreateCommon(
|
|||
// If we have a role, we don't even consider parent policies; the role
|
||||
// allowed policies trumps all
|
||||
case role != nil:
|
||||
if !strListSubset(role.AllowedPolicies, data.Policies) {
|
||||
return logical.ErrorResponse("token policies must be subset of the role's allowed policies"), logical.ErrInvalidRequest
|
||||
if len(data.Policies) == 0 {
|
||||
data.Policies = role.AllowedPolicies
|
||||
} else {
|
||||
if !strListSubset(role.AllowedPolicies, data.Policies) {
|
||||
return logical.ErrorResponse("token policies must be subset of the role's allowed policies"), logical.ErrInvalidRequest
|
||||
}
|
||||
}
|
||||
|
||||
case len(data.Policies) == 0:
|
||||
|
|
|
|||
Loading…
Reference in a new issue