add regex rule priority, drop request from selector signature, add unit tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2021-07-02 13:41:51 +02:00
parent 4385d3dacb
commit b540ccdf10
4 changed files with 160 additions and 74 deletions
+12 -4
View File
@@ -1,6 +1,8 @@
package config
import "context"
import (
"context"
)
// Log defines the available logging configuration.
type Log struct {
@@ -176,9 +178,15 @@ type ClaimsSelectorConf struct {
// RegexSelectorConf is the config for the regex-selector
type RegexSelectorConf struct {
DefaultPolicy string `mapstructure:"default_policy"`
MatchesPolicies map[string]map[string]string `mapstructure:"matches_policies"`
UnauthenticatedPolicy string `mapstructure:"unauthenticated_policy"`
DefaultPolicy string `mapstructure:"default_policy"`
MatchesPolicies []RegexRuleConf `mapstructure:"matches_policies"`
UnauthenticatedPolicy string `mapstructure:"unauthenticated_policy"`
}
type RegexRuleConf struct {
Priority int `mapstructure:"priority"`
Property string `mapstructure:"property"`
Match string `mapstructure:"match"`
Policy string `mapstructure:"policy"`
}
// New initializes a new configuration