mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
1600e0f7da
* [CI] Add wsl linter * Implement wsl recommendations Co-authored-by: Clément Michaud <clement.michaud34@gmail.com>
26 lines
496 B
Go
26 lines
496 B
Go
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 {
|
|
match, err := regexp.MatchString(pathRegexp, path)
|
|
if err != nil {
|
|
// TODO(c.michaud): make sure this is safe in advance to
|
|
// avoid checking this case here.
|
|
continue
|
|
}
|
|
|
|
if match {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|