|
|
|
@ -105,16 +105,10 @@ func convertPrincipal(principal interface{}) (*policy_engine.StringOrStringSlice |
|
|
|
// Example: {"AWS": "arn:aws:iam::123456789012:user/Alice"}
|
|
|
|
// Only AWS principals are supported for now. Other types like Service or Federated need special handling.
|
|
|
|
|
|
|
|
// Check that ONLY the "AWS" key is present
|
|
|
|
if len(p) != 1 { |
|
|
|
glog.Warningf("unsupported principal map, only single 'AWS' key is supported: %v", p) |
|
|
|
return nil, fmt.Errorf("unsupported principal map, only single 'AWS' key is supported, got keys: %v", getMapKeys(p)) |
|
|
|
} |
|
|
|
|
|
|
|
awsPrincipals, ok := p["AWS"] |
|
|
|
if !ok { |
|
|
|
glog.Warningf("unsupported principal map, only 'AWS' key is supported: %v", p) |
|
|
|
return nil, fmt.Errorf("unsupported principal type, only 'AWS' principals are supported, got keys: %v", getMapKeys(p)) |
|
|
|
if !ok || len(p) != 1 { |
|
|
|
glog.Warningf("unsupported principal map, only a single 'AWS' key is supported: %v", p) |
|
|
|
return nil, fmt.Errorf("unsupported principal map, only a single 'AWS' key is supported, got keys: %v", getMapKeys(p)) |
|
|
|
} |
|
|
|
|
|
|
|
switch val := awsPrincipals.(type) { |
|
|
|
|