Skip to content

Commit

Permalink
feature: matcher supports negative match any conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
greenpau committed Mar 10, 2024
1 parent 0e86490 commit 02a0610
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ qtest: covdir
@#time richgo test $(VERBOSE) $(TEST) -coverprofile=.coverage/coverage.out ./pkg/identity/...
@#time richgo test $(VERBOSE) $(TEST) -coverprofile=.coverage/coverage.out ./pkg/authn/backends/...
@#time richgo test $(VERBOSE) $(TEST) -coverprofile=.coverage/coverage.out -run NewAPIKey ./pkg/identity/...
@go tool cover -html=.coverage/coverage.out -o .coverage/coverage.html
@#
@#go tool cover -html=.coverage/coverage.out -o .coverage/coverage.html;
@#go tool cover -func=.coverage/coverage.out | grep -v "100.0"
@go tool cover -func=.coverage/coverage.out
@#go tool cover -func=.coverage/coverage.out;
@echo "$@: complete"

.PHONY: dep
Expand Down
14 changes: 14 additions & 0 deletions pkg/acl/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeStr",
"field": "roles",
"input_data_type": "dataTypeListStr",
"match_any": false,
"match_strategy": "fieldMatchExact",
"regex_enabled": false,
"values": [
Expand Down Expand Up @@ -347,6 +348,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeStr",
"field": "email",
"input_data_type": "dataTypeStr",
"match_any": false,
"match_strategy": "fieldMatchSuffix",
"regex_enabled": false,
"values": [
Expand All @@ -359,6 +361,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeStr",
"field": "roles",
"input_data_type": "dataTypeListStr",
"match_any": false,
"match_strategy": "fieldMatchExact",
"regex_enabled": false,
"values": [
Expand Down Expand Up @@ -387,6 +390,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "exp",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldMatchAlways",
"regex_enabled": false
}
Expand Down Expand Up @@ -446,6 +450,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "roles",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldFound",
"regex_enabled": false
},
Expand All @@ -455,6 +460,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeStr",
"field": "email",
"input_data_type": "dataTypeStr",
"match_any": false,
"match_strategy": "fieldMatchSuffix",
"regex_enabled": false,
"values": [
Expand All @@ -481,6 +487,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "exp",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldMatchAlways",
"regex_enabled": false
}
Expand Down Expand Up @@ -540,6 +547,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "roles",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldFound",
"regex_enabled": false
},
Expand All @@ -549,6 +557,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeStr",
"field": "email",
"input_data_type": "dataTypeStr",
"match_any": false,
"match_strategy": "fieldMatchSuffix",
"regex_enabled": false,
"values": [
Expand All @@ -575,6 +584,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "exp",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldMatchAlways",
"regex_enabled": false
}
Expand Down Expand Up @@ -656,6 +666,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "roles",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldFound",
"regex_enabled": false
}
Expand All @@ -681,6 +692,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "exp",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldMatchAlways",
"regex_enabled": false
}
Expand Down Expand Up @@ -739,6 +751,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "roles",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldNotFound",
"regex_enabled": false
}
Expand All @@ -763,6 +776,7 @@ func TestCustomAccessList(t *testing.T) {
"expr_data_type": "dataTypeAny",
"field": "exp",
"input_data_type": "dataTypeAny",
"match_any": false,
"match_strategy": "fieldMatchAlways",
"regex_enabled": false
}
Expand Down
Loading

0 comments on commit 02a0610

Please sign in to comment.