Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllMatcher ¶
type AllMatcher struct{}
AllMatcher matches all paths
func NewAllMatcher ¶
func NewAllMatcher() *AllMatcher
func (*AllMatcher) Match ¶
func (m *AllMatcher) Match(path string) bool
type Config ¶
type Config struct {
Rules []RuleConfig `yaml:"rules,omitempty"`
}
Config represents the rules configuration
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
GetDefaultConfig returns the default rules configuration (require auth for all)
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator evaluates path access rules
func NewEvaluator ¶
NewEvaluator creates a new rule evaluator from configuration
func (*Evaluator) Evaluate ¶
Evaluate evaluates a path against all rules and returns the action Rules are evaluated in order, and the first matching rule determines the action
func (*Evaluator) ShouldAllow ¶
ShouldAllow returns true if the path should be allowed without authentication
func (*Evaluator) ShouldAuth ¶
ShouldAuth returns true if the path requires authentication
func (*Evaluator) ShouldDeny ¶
ShouldDeny returns true if the path should be denied (403)
type ExactMatcher ¶
type ExactMatcher struct {
// contains filtered or unexported fields
}
ExactMatcher matches exact paths
func NewExactMatcher ¶
func NewExactMatcher(path string) *ExactMatcher
func (*ExactMatcher) Match ¶
func (m *ExactMatcher) Match(path string) bool
type MinimatchMatcher ¶
type MinimatchMatcher struct {
// contains filtered or unexported fields
}
MinimatchMatcher matches paths using glob/minimatch patterns
func NewMinimatchMatcher ¶
func NewMinimatchMatcher(pattern string) (*MinimatchMatcher, error)
func (*MinimatchMatcher) Match ¶
func (m *MinimatchMatcher) Match(path string) bool
type PrefixMatcher ¶
type PrefixMatcher struct {
// contains filtered or unexported fields
}
PrefixMatcher matches path prefixes
func NewPrefixMatcher ¶
func NewPrefixMatcher(prefix string) *PrefixMatcher
func (*PrefixMatcher) Match ¶
func (m *PrefixMatcher) Match(path string) bool
type RegexMatcher ¶
type RegexMatcher struct {
// contains filtered or unexported fields
}
RegexMatcher matches paths using regular expressions
func NewRegexMatcher ¶
func NewRegexMatcher(pattern string) (*RegexMatcher, error)
func (*RegexMatcher) Match ¶
func (m *RegexMatcher) Match(path string) bool
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Rule represents a compiled rule with a matcher and action
type RuleConfig ¶
type RuleConfig struct {
// Matchers (only one should be specified)
Exact string `yaml:"exact,omitempty"` // Exact path match
Prefix string `yaml:"prefix,omitempty"` // Prefix match
Regex string `yaml:"regex,omitempty"` // Regular expression match
Minimatch string `yaml:"minimatch,omitempty"` // Glob/minimatch pattern
All *bool `yaml:"all,omitempty"` // Match all paths (must be true if specified)
// Action to take when matched
Action Action `yaml:"action"`
// Optional description for documentation
Description string `yaml:"description,omitempty"`
}
RuleConfig represents a single rule in the configuration
func (*RuleConfig) Validate ¶
func (r *RuleConfig) Validate() error
Validate validates a single rule configuration