Update web wildcard to enable /foo/bar/baz/* to verify /foo/bar/baz
This commit is contained in:
parent
dad011cab4
commit
877fe5fb0a
@ -22,7 +22,7 @@ func Verify(rules []*auth.Rule, acc *auth.Account, res *auth.Resource) error {
|
|||||||
// e.g. /foo/* would include /foo/bar. We also want to check for wildcards and the exact endpoint
|
// e.g. /foo/* would include /foo/bar. We also want to check for wildcards and the exact endpoint
|
||||||
validEndpoints := []string{"*", res.Endpoint}
|
validEndpoints := []string{"*", res.Endpoint}
|
||||||
if comps := strings.Split(res.Endpoint, "/"); len(comps) > 1 {
|
if comps := strings.Split(res.Endpoint, "/"); len(comps) > 1 {
|
||||||
for i := 1; i < len(comps); i++ {
|
for i := 1; i < len(comps)+1; i++ {
|
||||||
wildcard := fmt.Sprintf("%v/*", strings.Join(comps[0:i], "/"))
|
wildcard := fmt.Sprintf("%v/*", strings.Join(comps[0:i], "/"))
|
||||||
validEndpoints = append(validEndpoints, wildcard)
|
validEndpoints = append(validEndpoints, wildcard)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user