authelia/internal/authorization/access_control_resource.go
James Elliott 3c1bb3ec19
feat(authorization): domain regex match with named groups (#2789)
This adds an option to match domains by regex including two special named matching groups. User matches the username of the user, and Group matches the groups a user is a member of. These are both case-insensitive and you can see examples in the docs.
2022-04-01 22:38:49 +11:00

16 lines
345 B
Go

package authorization
import (
"regexp"
)
// AccessControlResource represents an ACL resource.
type AccessControlResource struct {
Pattern regexp.Regexp
}
// IsMatch returns true if the ACL resource match the object path.
func (acr AccessControlResource) IsMatch(object Object) (match bool) {
return acr.Pattern.MatchString(object.Path)
}