mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
fix: extract array type for policy claim if present (#10014)
This commit is contained in:
@@ -39,10 +39,11 @@ type Args struct {
|
||||
Claims map[string]interface{} `json:"claims"`
|
||||
}
|
||||
|
||||
// GetPolicies get policies
|
||||
func (a Args) GetPolicies(policyClaimName string) (set.StringSet, bool) {
|
||||
// GetPoliciesFromClaims returns the list of policies to be applied for this
|
||||
// incoming request, extracting the information from input JWT claims.
|
||||
func GetPoliciesFromClaims(claims map[string]interface{}, policyClaimName string) (set.StringSet, bool) {
|
||||
s := set.NewStringSet()
|
||||
pname, ok := a.Claims[policyClaimName]
|
||||
pname, ok := claims[policyClaimName]
|
||||
if !ok {
|
||||
return s, false
|
||||
}
|
||||
@@ -67,6 +68,12 @@ func (a Args) GetPolicies(policyClaimName string) (set.StringSet, bool) {
|
||||
return s, true
|
||||
}
|
||||
|
||||
// GetPolicies returns the list of policies to be applied for this
|
||||
// incoming request, extracting the information from JWT claims.
|
||||
func (a Args) GetPolicies(policyClaimName string) (set.StringSet, bool) {
|
||||
return GetPoliciesFromClaims(a.Claims, policyClaimName)
|
||||
}
|
||||
|
||||
// Policy - iam bucket iamp.
|
||||
type Policy struct {
|
||||
ID policy.ID `json:"ID,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user