2020-02-18 22:15:09 +00:00
|
|
|
package authorization
|
|
|
|
|
|
|
|
import "regexp"
|
|
|
|
|
|
|
|
func isPathMatching(path string, pathRegexps []string) bool {
|
|
|
|
// If there is no regexp patterns, it means that we match any path.
|
|
|
|
if len(pathRegexps) == 0 {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, pathRegexp := range pathRegexps {
|
2021-01-16 10:05:41 +00:00
|
|
|
match, _ := regexp.MatchString(pathRegexp, path)
|
2020-02-18 22:15:09 +00:00
|
|
|
if match {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2020-05-05 19:35:32 +00:00
|
|
|
|
2020-02-18 22:15:09 +00:00
|
|
|
return false
|
|
|
|
}
|