github.com/greenpau/go-authcrunch@v1.1.4/pkg/acl/condition_test.go (about) 1 // Copyright 2022 Paul Greenberg greenpau@outlook.com 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package acl 16 17 import ( 18 "context" 19 "fmt" 20 "github.com/greenpau/go-authcrunch/internal/tests" 21 "github.com/greenpau/go-authcrunch/pkg/errors" 22 "reflect" 23 "strings" 24 "testing" 25 ) 26 27 func TestNewAclRuleCondition(t *testing.T) { 28 var testcases = []struct { 29 name string 30 condition string 31 want map[string]interface{} 32 shouldErr bool 33 err error 34 }{ 35 {name: "exact match a list of strings input against a list of strings in groups field", 36 condition: `exact match groups barfoo foobar`, 37 want: map[string]interface{}{ 38 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 39 "field_name": "roles", 40 "regex_enabled": false, 41 "match_strategy": "fieldMatchExact", 42 "always_true": false, 43 "default_match_strategy": "fieldMatchUnknown", 44 "reserved_match_strategy": "fieldMatchReserved", 45 "default_data_type": "dataTypeUnknown", 46 "expr_data_type": "dataTypeListStr", 47 "input_data_type": "dataTypeListStr", 48 "values": []string{`barfoo`, `foobar`}, 49 }, 50 }, 51 {name: "exact match a list of strings input against a list of strings in roles field", 52 condition: `exact match roles barfoo foobar`, 53 want: map[string]interface{}{ 54 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 55 "field_name": "roles", 56 "regex_enabled": false, 57 "match_strategy": "fieldMatchExact", 58 "always_true": false, 59 "default_match_strategy": "fieldMatchUnknown", 60 "reserved_match_strategy": "fieldMatchReserved", 61 "default_data_type": "dataTypeUnknown", 62 "expr_data_type": "dataTypeListStr", 63 "input_data_type": "dataTypeListStr", 64 "values": []string{`barfoo`, `foobar`}, 65 }, 66 }, {name: "default match a list of strings input against a list of strings in roles field", 67 condition: ` match roles barfoo foobar`, 68 want: map[string]interface{}{ 69 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 70 "field_name": "roles", 71 "regex_enabled": false, 72 "match_strategy": "fieldMatchExact", 73 "always_true": false, 74 "default_match_strategy": "fieldMatchUnknown", 75 "reserved_match_strategy": "fieldMatchReserved", 76 "default_data_type": "dataTypeUnknown", 77 "expr_data_type": "dataTypeListStr", 78 "input_data_type": "dataTypeListStr", 79 "values": []string{`barfoo`, `foobar`}, 80 }, 81 }, {name: "exact match a list of strings input against a string condition in roles field", 82 condition: `exact match roles foobar`, 83 want: map[string]interface{}{ 84 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 85 "field_name": "roles", 86 "regex_enabled": false, 87 "match_strategy": "fieldMatchExact", 88 "always_true": false, 89 "default_match_strategy": "fieldMatchUnknown", 90 "reserved_match_strategy": "fieldMatchReserved", 91 "default_data_type": "dataTypeUnknown", 92 "expr_data_type": "dataTypeStr", 93 "input_data_type": "dataTypeListStr", 94 "values": []string{`foobar`}, 95 }, 96 }, {name: "default match a list of strings input against a string condition in roles field", 97 condition: ` match roles foobar`, 98 want: map[string]interface{}{ 99 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 100 "field_name": "roles", 101 "regex_enabled": false, 102 "match_strategy": "fieldMatchExact", 103 "always_true": false, 104 "default_match_strategy": "fieldMatchUnknown", 105 "reserved_match_strategy": "fieldMatchReserved", 106 "default_data_type": "dataTypeUnknown", 107 "expr_data_type": "dataTypeStr", 108 "input_data_type": "dataTypeListStr", 109 "values": []string{`foobar`}, 110 }, 111 }, {name: "partial match a list of strings input against a list of strings in roles field", 112 condition: `partial match roles barfoo foobar`, 113 want: map[string]interface{}{ 114 "condition_type": "*acl.ruleListStrCondPartialMatchListStrInput", 115 "field_name": "roles", 116 "regex_enabled": false, 117 "match_strategy": "fieldMatchPartial", 118 "always_true": false, 119 "default_match_strategy": "fieldMatchUnknown", 120 "reserved_match_strategy": "fieldMatchReserved", 121 "default_data_type": "dataTypeUnknown", 122 "expr_data_type": "dataTypeListStr", 123 "input_data_type": "dataTypeListStr", 124 "values": []string{`barfoo`, `foobar`}, 125 }, 126 }, {name: "partial match a list of strings input against a string condition in roles field", 127 condition: `partial match roles foobar`, 128 want: map[string]interface{}{ 129 "condition_type": "*acl.ruleStrCondPartialMatchListStrInput", 130 "field_name": "roles", 131 "regex_enabled": false, 132 "match_strategy": "fieldMatchPartial", 133 "always_true": false, 134 "default_match_strategy": "fieldMatchUnknown", 135 "reserved_match_strategy": "fieldMatchReserved", 136 "default_data_type": "dataTypeUnknown", 137 "expr_data_type": "dataTypeStr", 138 "input_data_type": "dataTypeListStr", 139 "values": []string{`foobar`}, 140 }, 141 }, {name: "prefix match a list of strings input against a list of strings in roles field", 142 condition: `prefix match roles barfoo foobar`, 143 want: map[string]interface{}{ 144 "condition_type": "*acl.ruleListStrCondPrefixMatchListStrInput", 145 "field_name": "roles", 146 "regex_enabled": false, 147 "match_strategy": "fieldMatchPrefix", 148 "always_true": false, 149 "default_match_strategy": "fieldMatchUnknown", 150 "reserved_match_strategy": "fieldMatchReserved", 151 "default_data_type": "dataTypeUnknown", 152 "expr_data_type": "dataTypeListStr", 153 "input_data_type": "dataTypeListStr", 154 "values": []string{`barfoo`, `foobar`}, 155 }, 156 }, {name: "prefix match a list of strings input against a string condition in roles field", 157 condition: `prefix match roles foobar`, 158 want: map[string]interface{}{ 159 "condition_type": "*acl.ruleStrCondPrefixMatchListStrInput", 160 "field_name": "roles", 161 "regex_enabled": false, 162 "match_strategy": "fieldMatchPrefix", 163 "always_true": false, 164 "default_match_strategy": "fieldMatchUnknown", 165 "reserved_match_strategy": "fieldMatchReserved", 166 "default_data_type": "dataTypeUnknown", 167 "expr_data_type": "dataTypeStr", 168 "input_data_type": "dataTypeListStr", 169 "values": []string{`foobar`}, 170 }, 171 }, {name: "suffix match a list of strings input against a list of strings in roles field", 172 condition: `suffix match roles barfoo foobar`, 173 want: map[string]interface{}{ 174 "condition_type": "*acl.ruleListStrCondSuffixMatchListStrInput", 175 "field_name": "roles", 176 "regex_enabled": false, 177 "match_strategy": "fieldMatchSuffix", 178 "always_true": false, 179 "default_match_strategy": "fieldMatchUnknown", 180 "reserved_match_strategy": "fieldMatchReserved", 181 "default_data_type": "dataTypeUnknown", 182 "expr_data_type": "dataTypeListStr", 183 "input_data_type": "dataTypeListStr", 184 "values": []string{`barfoo`, `foobar`}, 185 }, 186 }, {name: "suffix match a list of strings input against a string condition in roles field", 187 condition: `suffix match roles foobar`, 188 want: map[string]interface{}{ 189 "condition_type": "*acl.ruleStrCondSuffixMatchListStrInput", 190 "field_name": "roles", 191 "regex_enabled": false, 192 "match_strategy": "fieldMatchSuffix", 193 "always_true": false, 194 "default_match_strategy": "fieldMatchUnknown", 195 "reserved_match_strategy": "fieldMatchReserved", 196 "default_data_type": "dataTypeUnknown", 197 "expr_data_type": "dataTypeStr", 198 "input_data_type": "dataTypeListStr", 199 "values": []string{`foobar`}, 200 }, 201 }, {name: "regex match a list of strings input against a list of strings in roles field", 202 condition: `regex match roles barfoo foobar`, 203 want: map[string]interface{}{ 204 "condition_type": "*acl.ruleListStrCondRegexMatchListStrInput", 205 "field_name": "roles", 206 "regex_enabled": true, 207 "match_strategy": "fieldMatchRegex", 208 "always_true": false, 209 "default_match_strategy": "fieldMatchUnknown", 210 "reserved_match_strategy": "fieldMatchReserved", 211 "default_data_type": "dataTypeUnknown", 212 "expr_data_type": "dataTypeListStr", 213 "input_data_type": "dataTypeListStr", 214 "values": []string{`barfoo`, `foobar`}, 215 }, 216 }, { 217 name: "failed regex match a list of strings input against a list of strings in roles field", 218 condition: `regex match roles barfoo (foobar|raboff`, 219 shouldErr: true, 220 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 221 }, {name: "regex match a list of strings input against a string condition in roles field", 222 condition: `regex match roles foobar`, 223 want: map[string]interface{}{ 224 "condition_type": "*acl.ruleStrCondRegexMatchListStrInput", 225 "field_name": "roles", 226 "regex_enabled": true, 227 "match_strategy": "fieldMatchRegex", 228 "always_true": false, 229 "default_match_strategy": "fieldMatchUnknown", 230 "reserved_match_strategy": "fieldMatchReserved", 231 "default_data_type": "dataTypeUnknown", 232 "expr_data_type": "dataTypeStr", 233 "input_data_type": "dataTypeListStr", 234 "values": []string{`foobar`}, 235 }, 236 }, { 237 name: "failed regex match a list of strings input against a string condition in roles field", 238 condition: `regex match roles foobar|raboff)`, 239 shouldErr: true, 240 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 241 }, {name: "exact match an input string against a list of strings in email field", 242 condition: `exact match email barfoo foobar`, 243 want: map[string]interface{}{ 244 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 245 "field_name": "email", 246 "regex_enabled": false, 247 "match_strategy": "fieldMatchExact", 248 "always_true": false, 249 "default_match_strategy": "fieldMatchUnknown", 250 "reserved_match_strategy": "fieldMatchReserved", 251 "default_data_type": "dataTypeUnknown", 252 "expr_data_type": "dataTypeListStr", 253 "input_data_type": "dataTypeStr", 254 "values": []string{`barfoo`, `foobar`}, 255 }, 256 }, {name: "default match an input string against a list of strings in email field", 257 condition: ` match email barfoo foobar`, 258 want: map[string]interface{}{ 259 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 260 "field_name": "email", 261 "regex_enabled": false, 262 "match_strategy": "fieldMatchExact", 263 "always_true": false, 264 "default_match_strategy": "fieldMatchUnknown", 265 "reserved_match_strategy": "fieldMatchReserved", 266 "default_data_type": "dataTypeUnknown", 267 "expr_data_type": "dataTypeListStr", 268 "input_data_type": "dataTypeStr", 269 "values": []string{`barfoo`, `foobar`}, 270 }, 271 }, {name: "exact match an input string against a string condition in email field", 272 condition: `exact match email foobar`, 273 want: map[string]interface{}{ 274 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 275 "field_name": "email", 276 "regex_enabled": false, 277 "match_strategy": "fieldMatchExact", 278 "always_true": false, 279 "default_match_strategy": "fieldMatchUnknown", 280 "reserved_match_strategy": "fieldMatchReserved", 281 "default_data_type": "dataTypeUnknown", 282 "expr_data_type": "dataTypeStr", 283 "input_data_type": "dataTypeStr", 284 "values": []string{`foobar`}, 285 }, 286 }, {name: "default match an input string against a string condition in email field", 287 condition: ` match email foobar`, 288 want: map[string]interface{}{ 289 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 290 "field_name": "email", 291 "regex_enabled": false, 292 "match_strategy": "fieldMatchExact", 293 "always_true": false, 294 "default_match_strategy": "fieldMatchUnknown", 295 "reserved_match_strategy": "fieldMatchReserved", 296 "default_data_type": "dataTypeUnknown", 297 "expr_data_type": "dataTypeStr", 298 "input_data_type": "dataTypeStr", 299 "values": []string{`foobar`}, 300 }, 301 }, {name: "partial match an input string against a list of strings in email field", 302 condition: `partial match email barfoo foobar`, 303 want: map[string]interface{}{ 304 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 305 "field_name": "email", 306 "regex_enabled": false, 307 "match_strategy": "fieldMatchPartial", 308 "always_true": false, 309 "default_match_strategy": "fieldMatchUnknown", 310 "reserved_match_strategy": "fieldMatchReserved", 311 "default_data_type": "dataTypeUnknown", 312 "expr_data_type": "dataTypeListStr", 313 "input_data_type": "dataTypeStr", 314 "values": []string{`barfoo`, `foobar`}, 315 }, 316 }, {name: "partial match an input string against a string condition in email field", 317 condition: `partial match email foobar`, 318 want: map[string]interface{}{ 319 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 320 "field_name": "email", 321 "regex_enabled": false, 322 "match_strategy": "fieldMatchPartial", 323 "always_true": false, 324 "default_match_strategy": "fieldMatchUnknown", 325 "reserved_match_strategy": "fieldMatchReserved", 326 "default_data_type": "dataTypeUnknown", 327 "expr_data_type": "dataTypeStr", 328 "input_data_type": "dataTypeStr", 329 "values": []string{`foobar`}, 330 }, 331 }, {name: "prefix match an input string against a list of strings in email field", 332 condition: `prefix match email barfoo foobar`, 333 want: map[string]interface{}{ 334 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 335 "field_name": "email", 336 "regex_enabled": false, 337 "match_strategy": "fieldMatchPrefix", 338 "always_true": false, 339 "default_match_strategy": "fieldMatchUnknown", 340 "reserved_match_strategy": "fieldMatchReserved", 341 "default_data_type": "dataTypeUnknown", 342 "expr_data_type": "dataTypeListStr", 343 "input_data_type": "dataTypeStr", 344 "values": []string{`barfoo`, `foobar`}, 345 }, 346 }, {name: "prefix match an input string against a string condition in email field", 347 condition: `prefix match email foobar`, 348 want: map[string]interface{}{ 349 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 350 "field_name": "email", 351 "regex_enabled": false, 352 "match_strategy": "fieldMatchPrefix", 353 "always_true": false, 354 "default_match_strategy": "fieldMatchUnknown", 355 "reserved_match_strategy": "fieldMatchReserved", 356 "default_data_type": "dataTypeUnknown", 357 "expr_data_type": "dataTypeStr", 358 "input_data_type": "dataTypeStr", 359 "values": []string{`foobar`}, 360 }, 361 }, {name: "suffix match an input string against a list of strings in email field", 362 condition: `suffix match email barfoo foobar`, 363 want: map[string]interface{}{ 364 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 365 "field_name": "email", 366 "regex_enabled": false, 367 "match_strategy": "fieldMatchSuffix", 368 "always_true": false, 369 "default_match_strategy": "fieldMatchUnknown", 370 "reserved_match_strategy": "fieldMatchReserved", 371 "default_data_type": "dataTypeUnknown", 372 "expr_data_type": "dataTypeListStr", 373 "input_data_type": "dataTypeStr", 374 "values": []string{`barfoo`, `foobar`}, 375 }, 376 }, {name: "suffix match an input string against a string condition in email field", 377 condition: `suffix match email foobar`, 378 want: map[string]interface{}{ 379 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 380 "field_name": "email", 381 "regex_enabled": false, 382 "match_strategy": "fieldMatchSuffix", 383 "always_true": false, 384 "default_match_strategy": "fieldMatchUnknown", 385 "reserved_match_strategy": "fieldMatchReserved", 386 "default_data_type": "dataTypeUnknown", 387 "expr_data_type": "dataTypeStr", 388 "input_data_type": "dataTypeStr", 389 "values": []string{`foobar`}, 390 }, 391 }, {name: "regex match an input string against a list of strings in email field", 392 condition: `regex match email barfoo foobar`, 393 want: map[string]interface{}{ 394 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 395 "field_name": "email", 396 "regex_enabled": true, 397 "match_strategy": "fieldMatchRegex", 398 "always_true": false, 399 "default_match_strategy": "fieldMatchUnknown", 400 "reserved_match_strategy": "fieldMatchReserved", 401 "default_data_type": "dataTypeUnknown", 402 "expr_data_type": "dataTypeListStr", 403 "input_data_type": "dataTypeStr", 404 "values": []string{`barfoo`, `foobar`}, 405 }, 406 }, { 407 name: "failed regex match an input string against a list of strings in email field", 408 condition: `regex match email barfoo (foobar|raboff`, 409 shouldErr: true, 410 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 411 }, {name: "regex match an input string against a string condition in email field", 412 condition: `regex match email foobar`, 413 want: map[string]interface{}{ 414 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 415 "field_name": "email", 416 "regex_enabled": true, 417 "match_strategy": "fieldMatchRegex", 418 "always_true": false, 419 "default_match_strategy": "fieldMatchUnknown", 420 "reserved_match_strategy": "fieldMatchReserved", 421 "default_data_type": "dataTypeUnknown", 422 "expr_data_type": "dataTypeStr", 423 "input_data_type": "dataTypeStr", 424 "values": []string{`foobar`}, 425 }, 426 }, { 427 name: "failed regex match an input string against a string condition in email field", 428 condition: `regex match email foobar|raboff)`, 429 shouldErr: true, 430 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 431 }, {name: "exact match an input string against a list of strings in origin field", 432 condition: `exact match origin barfoo foobar`, 433 want: map[string]interface{}{ 434 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 435 "field_name": "origin", 436 "regex_enabled": false, 437 "match_strategy": "fieldMatchExact", 438 "always_true": false, 439 "default_match_strategy": "fieldMatchUnknown", 440 "reserved_match_strategy": "fieldMatchReserved", 441 "default_data_type": "dataTypeUnknown", 442 "expr_data_type": "dataTypeListStr", 443 "input_data_type": "dataTypeStr", 444 "values": []string{`barfoo`, `foobar`}, 445 }, 446 }, {name: "default match an input string against a list of strings in origin field", 447 condition: ` match origin barfoo foobar`, 448 want: map[string]interface{}{ 449 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 450 "field_name": "origin", 451 "regex_enabled": false, 452 "match_strategy": "fieldMatchExact", 453 "always_true": false, 454 "default_match_strategy": "fieldMatchUnknown", 455 "reserved_match_strategy": "fieldMatchReserved", 456 "default_data_type": "dataTypeUnknown", 457 "expr_data_type": "dataTypeListStr", 458 "input_data_type": "dataTypeStr", 459 "values": []string{`barfoo`, `foobar`}, 460 }, 461 }, {name: "exact match an input string against a string condition in origin field", 462 condition: `exact match origin foobar`, 463 want: map[string]interface{}{ 464 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 465 "field_name": "origin", 466 "regex_enabled": false, 467 "match_strategy": "fieldMatchExact", 468 "always_true": false, 469 "default_match_strategy": "fieldMatchUnknown", 470 "reserved_match_strategy": "fieldMatchReserved", 471 "default_data_type": "dataTypeUnknown", 472 "expr_data_type": "dataTypeStr", 473 "input_data_type": "dataTypeStr", 474 "values": []string{`foobar`}, 475 }, 476 }, {name: "default match an input string against a string condition in origin field", 477 condition: ` match origin foobar`, 478 want: map[string]interface{}{ 479 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 480 "field_name": "origin", 481 "regex_enabled": false, 482 "match_strategy": "fieldMatchExact", 483 "always_true": false, 484 "default_match_strategy": "fieldMatchUnknown", 485 "reserved_match_strategy": "fieldMatchReserved", 486 "default_data_type": "dataTypeUnknown", 487 "expr_data_type": "dataTypeStr", 488 "input_data_type": "dataTypeStr", 489 "values": []string{`foobar`}, 490 }, 491 }, {name: "partial match an input string against a list of strings in origin field", 492 condition: `partial match origin barfoo foobar`, 493 want: map[string]interface{}{ 494 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 495 "field_name": "origin", 496 "regex_enabled": false, 497 "match_strategy": "fieldMatchPartial", 498 "always_true": false, 499 "default_match_strategy": "fieldMatchUnknown", 500 "reserved_match_strategy": "fieldMatchReserved", 501 "default_data_type": "dataTypeUnknown", 502 "expr_data_type": "dataTypeListStr", 503 "input_data_type": "dataTypeStr", 504 "values": []string{`barfoo`, `foobar`}, 505 }, 506 }, {name: "partial match an input string against a string condition in origin field", 507 condition: `partial match origin foobar`, 508 want: map[string]interface{}{ 509 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 510 "field_name": "origin", 511 "regex_enabled": false, 512 "match_strategy": "fieldMatchPartial", 513 "always_true": false, 514 "default_match_strategy": "fieldMatchUnknown", 515 "reserved_match_strategy": "fieldMatchReserved", 516 "default_data_type": "dataTypeUnknown", 517 "expr_data_type": "dataTypeStr", 518 "input_data_type": "dataTypeStr", 519 "values": []string{`foobar`}, 520 }, 521 }, {name: "prefix match an input string against a list of strings in origin field", 522 condition: `prefix match origin barfoo foobar`, 523 want: map[string]interface{}{ 524 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 525 "field_name": "origin", 526 "regex_enabled": false, 527 "match_strategy": "fieldMatchPrefix", 528 "always_true": false, 529 "default_match_strategy": "fieldMatchUnknown", 530 "reserved_match_strategy": "fieldMatchReserved", 531 "default_data_type": "dataTypeUnknown", 532 "expr_data_type": "dataTypeListStr", 533 "input_data_type": "dataTypeStr", 534 "values": []string{`barfoo`, `foobar`}, 535 }, 536 }, {name: "prefix match an input string against a string condition in origin field", 537 condition: `prefix match origin foobar`, 538 want: map[string]interface{}{ 539 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 540 "field_name": "origin", 541 "regex_enabled": false, 542 "match_strategy": "fieldMatchPrefix", 543 "always_true": false, 544 "default_match_strategy": "fieldMatchUnknown", 545 "reserved_match_strategy": "fieldMatchReserved", 546 "default_data_type": "dataTypeUnknown", 547 "expr_data_type": "dataTypeStr", 548 "input_data_type": "dataTypeStr", 549 "values": []string{`foobar`}, 550 }, 551 }, {name: "suffix match an input string against a list of strings in origin field", 552 condition: `suffix match origin barfoo foobar`, 553 want: map[string]interface{}{ 554 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 555 "field_name": "origin", 556 "regex_enabled": false, 557 "match_strategy": "fieldMatchSuffix", 558 "always_true": false, 559 "default_match_strategy": "fieldMatchUnknown", 560 "reserved_match_strategy": "fieldMatchReserved", 561 "default_data_type": "dataTypeUnknown", 562 "expr_data_type": "dataTypeListStr", 563 "input_data_type": "dataTypeStr", 564 "values": []string{`barfoo`, `foobar`}, 565 }, 566 }, {name: "suffix match an input string against a string condition in origin field", 567 condition: `suffix match origin foobar`, 568 want: map[string]interface{}{ 569 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 570 "field_name": "origin", 571 "regex_enabled": false, 572 "match_strategy": "fieldMatchSuffix", 573 "always_true": false, 574 "default_match_strategy": "fieldMatchUnknown", 575 "reserved_match_strategy": "fieldMatchReserved", 576 "default_data_type": "dataTypeUnknown", 577 "expr_data_type": "dataTypeStr", 578 "input_data_type": "dataTypeStr", 579 "values": []string{`foobar`}, 580 }, 581 }, {name: "regex match an input string against a list of strings in origin field", 582 condition: `regex match origin barfoo foobar`, 583 want: map[string]interface{}{ 584 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 585 "field_name": "origin", 586 "regex_enabled": true, 587 "match_strategy": "fieldMatchRegex", 588 "always_true": false, 589 "default_match_strategy": "fieldMatchUnknown", 590 "reserved_match_strategy": "fieldMatchReserved", 591 "default_data_type": "dataTypeUnknown", 592 "expr_data_type": "dataTypeListStr", 593 "input_data_type": "dataTypeStr", 594 "values": []string{`barfoo`, `foobar`}, 595 }, 596 }, { 597 name: "failed regex match an input string against a list of strings in origin field", 598 condition: `regex match origin barfoo (foobar|raboff`, 599 shouldErr: true, 600 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 601 }, {name: "regex match an input string against a string condition in origin field", 602 condition: `regex match origin foobar`, 603 want: map[string]interface{}{ 604 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 605 "field_name": "origin", 606 "regex_enabled": true, 607 "match_strategy": "fieldMatchRegex", 608 "always_true": false, 609 "default_match_strategy": "fieldMatchUnknown", 610 "reserved_match_strategy": "fieldMatchReserved", 611 "default_data_type": "dataTypeUnknown", 612 "expr_data_type": "dataTypeStr", 613 "input_data_type": "dataTypeStr", 614 "values": []string{`foobar`}, 615 }, 616 }, { 617 name: "failed regex match an input string against a string condition in origin field", 618 condition: `regex match origin foobar|raboff)`, 619 shouldErr: true, 620 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 621 }, {name: "exact match an input string against a list of strings in name field", 622 condition: `exact match name barfoo foobar`, 623 want: map[string]interface{}{ 624 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 625 "field_name": "name", 626 "regex_enabled": false, 627 "match_strategy": "fieldMatchExact", 628 "always_true": false, 629 "default_match_strategy": "fieldMatchUnknown", 630 "reserved_match_strategy": "fieldMatchReserved", 631 "default_data_type": "dataTypeUnknown", 632 "expr_data_type": "dataTypeListStr", 633 "input_data_type": "dataTypeStr", 634 "values": []string{`barfoo`, `foobar`}, 635 }, 636 }, {name: "default match an input string against a list of strings in name field", 637 condition: ` match name barfoo foobar`, 638 want: map[string]interface{}{ 639 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 640 "field_name": "name", 641 "regex_enabled": false, 642 "match_strategy": "fieldMatchExact", 643 "always_true": false, 644 "default_match_strategy": "fieldMatchUnknown", 645 "reserved_match_strategy": "fieldMatchReserved", 646 "default_data_type": "dataTypeUnknown", 647 "expr_data_type": "dataTypeListStr", 648 "input_data_type": "dataTypeStr", 649 "values": []string{`barfoo`, `foobar`}, 650 }, 651 }, {name: "exact match an input string against a string condition in name field", 652 condition: `exact match name foobar`, 653 want: map[string]interface{}{ 654 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 655 "field_name": "name", 656 "regex_enabled": false, 657 "match_strategy": "fieldMatchExact", 658 "always_true": false, 659 "default_match_strategy": "fieldMatchUnknown", 660 "reserved_match_strategy": "fieldMatchReserved", 661 "default_data_type": "dataTypeUnknown", 662 "expr_data_type": "dataTypeStr", 663 "input_data_type": "dataTypeStr", 664 "values": []string{`foobar`}, 665 }, 666 }, {name: "default match an input string against a string condition in name field", 667 condition: ` match name foobar`, 668 want: map[string]interface{}{ 669 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 670 "field_name": "name", 671 "regex_enabled": false, 672 "match_strategy": "fieldMatchExact", 673 "always_true": false, 674 "default_match_strategy": "fieldMatchUnknown", 675 "reserved_match_strategy": "fieldMatchReserved", 676 "default_data_type": "dataTypeUnknown", 677 "expr_data_type": "dataTypeStr", 678 "input_data_type": "dataTypeStr", 679 "values": []string{`foobar`}, 680 }, 681 }, {name: "partial match an input string against a list of strings in name field", 682 condition: `partial match name barfoo foobar`, 683 want: map[string]interface{}{ 684 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 685 "field_name": "name", 686 "regex_enabled": false, 687 "match_strategy": "fieldMatchPartial", 688 "always_true": false, 689 "default_match_strategy": "fieldMatchUnknown", 690 "reserved_match_strategy": "fieldMatchReserved", 691 "default_data_type": "dataTypeUnknown", 692 "expr_data_type": "dataTypeListStr", 693 "input_data_type": "dataTypeStr", 694 "values": []string{`barfoo`, `foobar`}, 695 }, 696 }, {name: "partial match an input string against a string condition in name field", 697 condition: `partial match name foobar`, 698 want: map[string]interface{}{ 699 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 700 "field_name": "name", 701 "regex_enabled": false, 702 "match_strategy": "fieldMatchPartial", 703 "always_true": false, 704 "default_match_strategy": "fieldMatchUnknown", 705 "reserved_match_strategy": "fieldMatchReserved", 706 "default_data_type": "dataTypeUnknown", 707 "expr_data_type": "dataTypeStr", 708 "input_data_type": "dataTypeStr", 709 "values": []string{`foobar`}, 710 }, 711 }, {name: "prefix match an input string against a list of strings in name field", 712 condition: `prefix match name barfoo foobar`, 713 want: map[string]interface{}{ 714 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 715 "field_name": "name", 716 "regex_enabled": false, 717 "match_strategy": "fieldMatchPrefix", 718 "always_true": false, 719 "default_match_strategy": "fieldMatchUnknown", 720 "reserved_match_strategy": "fieldMatchReserved", 721 "default_data_type": "dataTypeUnknown", 722 "expr_data_type": "dataTypeListStr", 723 "input_data_type": "dataTypeStr", 724 "values": []string{`barfoo`, `foobar`}, 725 }, 726 }, {name: "prefix match an input string against a string condition in name field", 727 condition: `prefix match name foobar`, 728 want: map[string]interface{}{ 729 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 730 "field_name": "name", 731 "regex_enabled": false, 732 "match_strategy": "fieldMatchPrefix", 733 "always_true": false, 734 "default_match_strategy": "fieldMatchUnknown", 735 "reserved_match_strategy": "fieldMatchReserved", 736 "default_data_type": "dataTypeUnknown", 737 "expr_data_type": "dataTypeStr", 738 "input_data_type": "dataTypeStr", 739 "values": []string{`foobar`}, 740 }, 741 }, {name: "suffix match an input string against a list of strings in name field", 742 condition: `suffix match name barfoo foobar`, 743 want: map[string]interface{}{ 744 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 745 "field_name": "name", 746 "regex_enabled": false, 747 "match_strategy": "fieldMatchSuffix", 748 "always_true": false, 749 "default_match_strategy": "fieldMatchUnknown", 750 "reserved_match_strategy": "fieldMatchReserved", 751 "default_data_type": "dataTypeUnknown", 752 "expr_data_type": "dataTypeListStr", 753 "input_data_type": "dataTypeStr", 754 "values": []string{`barfoo`, `foobar`}, 755 }, 756 }, {name: "suffix match an input string against a string condition in name field", 757 condition: `suffix match name foobar`, 758 want: map[string]interface{}{ 759 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 760 "field_name": "name", 761 "regex_enabled": false, 762 "match_strategy": "fieldMatchSuffix", 763 "always_true": false, 764 "default_match_strategy": "fieldMatchUnknown", 765 "reserved_match_strategy": "fieldMatchReserved", 766 "default_data_type": "dataTypeUnknown", 767 "expr_data_type": "dataTypeStr", 768 "input_data_type": "dataTypeStr", 769 "values": []string{`foobar`}, 770 }, 771 }, {name: "regex match an input string against a list of strings in name field", 772 condition: `regex match name barfoo foobar`, 773 want: map[string]interface{}{ 774 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 775 "field_name": "name", 776 "regex_enabled": true, 777 "match_strategy": "fieldMatchRegex", 778 "always_true": false, 779 "default_match_strategy": "fieldMatchUnknown", 780 "reserved_match_strategy": "fieldMatchReserved", 781 "default_data_type": "dataTypeUnknown", 782 "expr_data_type": "dataTypeListStr", 783 "input_data_type": "dataTypeStr", 784 "values": []string{`barfoo`, `foobar`}, 785 }, 786 }, { 787 name: "failed regex match an input string against a list of strings in name field", 788 condition: `regex match name barfoo (foobar|raboff`, 789 shouldErr: true, 790 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 791 }, {name: "regex match an input string against a string condition in name field", 792 condition: `regex match name foobar`, 793 want: map[string]interface{}{ 794 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 795 "field_name": "name", 796 "regex_enabled": true, 797 "match_strategy": "fieldMatchRegex", 798 "always_true": false, 799 "default_match_strategy": "fieldMatchUnknown", 800 "reserved_match_strategy": "fieldMatchReserved", 801 "default_data_type": "dataTypeUnknown", 802 "expr_data_type": "dataTypeStr", 803 "input_data_type": "dataTypeStr", 804 "values": []string{`foobar`}, 805 }, 806 }, { 807 name: "failed regex match an input string against a string condition in name field", 808 condition: `regex match name foobar|raboff)`, 809 shouldErr: true, 810 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 811 }, {name: "exact match an input string against a list of strings in realm field", 812 condition: `exact match realm barfoo foobar`, 813 want: map[string]interface{}{ 814 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 815 "field_name": "realm", 816 "regex_enabled": false, 817 "match_strategy": "fieldMatchExact", 818 "always_true": false, 819 "default_match_strategy": "fieldMatchUnknown", 820 "reserved_match_strategy": "fieldMatchReserved", 821 "default_data_type": "dataTypeUnknown", 822 "expr_data_type": "dataTypeListStr", 823 "input_data_type": "dataTypeStr", 824 "values": []string{`barfoo`, `foobar`}, 825 }, 826 }, {name: "default match an input string against a list of strings in realm field", 827 condition: ` match realm barfoo foobar`, 828 want: map[string]interface{}{ 829 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 830 "field_name": "realm", 831 "regex_enabled": false, 832 "match_strategy": "fieldMatchExact", 833 "always_true": false, 834 "default_match_strategy": "fieldMatchUnknown", 835 "reserved_match_strategy": "fieldMatchReserved", 836 "default_data_type": "dataTypeUnknown", 837 "expr_data_type": "dataTypeListStr", 838 "input_data_type": "dataTypeStr", 839 "values": []string{`barfoo`, `foobar`}, 840 }, 841 }, {name: "exact match an input string against a string condition in realm field", 842 condition: `exact match realm foobar`, 843 want: map[string]interface{}{ 844 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 845 "field_name": "realm", 846 "regex_enabled": false, 847 "match_strategy": "fieldMatchExact", 848 "always_true": false, 849 "default_match_strategy": "fieldMatchUnknown", 850 "reserved_match_strategy": "fieldMatchReserved", 851 "default_data_type": "dataTypeUnknown", 852 "expr_data_type": "dataTypeStr", 853 "input_data_type": "dataTypeStr", 854 "values": []string{`foobar`}, 855 }, 856 }, {name: "default match an input string against a string condition in realm field", 857 condition: ` match realm foobar`, 858 want: map[string]interface{}{ 859 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 860 "field_name": "realm", 861 "regex_enabled": false, 862 "match_strategy": "fieldMatchExact", 863 "always_true": false, 864 "default_match_strategy": "fieldMatchUnknown", 865 "reserved_match_strategy": "fieldMatchReserved", 866 "default_data_type": "dataTypeUnknown", 867 "expr_data_type": "dataTypeStr", 868 "input_data_type": "dataTypeStr", 869 "values": []string{`foobar`}, 870 }, 871 }, {name: "partial match an input string against a list of strings in realm field", 872 condition: `partial match realm barfoo foobar`, 873 want: map[string]interface{}{ 874 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 875 "field_name": "realm", 876 "regex_enabled": false, 877 "match_strategy": "fieldMatchPartial", 878 "always_true": false, 879 "default_match_strategy": "fieldMatchUnknown", 880 "reserved_match_strategy": "fieldMatchReserved", 881 "default_data_type": "dataTypeUnknown", 882 "expr_data_type": "dataTypeListStr", 883 "input_data_type": "dataTypeStr", 884 "values": []string{`barfoo`, `foobar`}, 885 }, 886 }, {name: "partial match an input string against a string condition in realm field", 887 condition: `partial match realm foobar`, 888 want: map[string]interface{}{ 889 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 890 "field_name": "realm", 891 "regex_enabled": false, 892 "match_strategy": "fieldMatchPartial", 893 "always_true": false, 894 "default_match_strategy": "fieldMatchUnknown", 895 "reserved_match_strategy": "fieldMatchReserved", 896 "default_data_type": "dataTypeUnknown", 897 "expr_data_type": "dataTypeStr", 898 "input_data_type": "dataTypeStr", 899 "values": []string{`foobar`}, 900 }, 901 }, {name: "prefix match an input string against a list of strings in realm field", 902 condition: `prefix match realm barfoo foobar`, 903 want: map[string]interface{}{ 904 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 905 "field_name": "realm", 906 "regex_enabled": false, 907 "match_strategy": "fieldMatchPrefix", 908 "always_true": false, 909 "default_match_strategy": "fieldMatchUnknown", 910 "reserved_match_strategy": "fieldMatchReserved", 911 "default_data_type": "dataTypeUnknown", 912 "expr_data_type": "dataTypeListStr", 913 "input_data_type": "dataTypeStr", 914 "values": []string{`barfoo`, `foobar`}, 915 }, 916 }, {name: "prefix match an input string against a string condition in realm field", 917 condition: `prefix match realm foobar`, 918 want: map[string]interface{}{ 919 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 920 "field_name": "realm", 921 "regex_enabled": false, 922 "match_strategy": "fieldMatchPrefix", 923 "always_true": false, 924 "default_match_strategy": "fieldMatchUnknown", 925 "reserved_match_strategy": "fieldMatchReserved", 926 "default_data_type": "dataTypeUnknown", 927 "expr_data_type": "dataTypeStr", 928 "input_data_type": "dataTypeStr", 929 "values": []string{`foobar`}, 930 }, 931 }, {name: "suffix match an input string against a list of strings in realm field", 932 condition: `suffix match realm barfoo foobar`, 933 want: map[string]interface{}{ 934 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 935 "field_name": "realm", 936 "regex_enabled": false, 937 "match_strategy": "fieldMatchSuffix", 938 "always_true": false, 939 "default_match_strategy": "fieldMatchUnknown", 940 "reserved_match_strategy": "fieldMatchReserved", 941 "default_data_type": "dataTypeUnknown", 942 "expr_data_type": "dataTypeListStr", 943 "input_data_type": "dataTypeStr", 944 "values": []string{`barfoo`, `foobar`}, 945 }, 946 }, {name: "suffix match an input string against a string condition in realm field", 947 condition: `suffix match realm foobar`, 948 want: map[string]interface{}{ 949 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 950 "field_name": "realm", 951 "regex_enabled": false, 952 "match_strategy": "fieldMatchSuffix", 953 "always_true": false, 954 "default_match_strategy": "fieldMatchUnknown", 955 "reserved_match_strategy": "fieldMatchReserved", 956 "default_data_type": "dataTypeUnknown", 957 "expr_data_type": "dataTypeStr", 958 "input_data_type": "dataTypeStr", 959 "values": []string{`foobar`}, 960 }, 961 }, {name: "regex match an input string against a list of strings in realm field", 962 condition: `regex match realm barfoo foobar`, 963 want: map[string]interface{}{ 964 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 965 "field_name": "realm", 966 "regex_enabled": true, 967 "match_strategy": "fieldMatchRegex", 968 "always_true": false, 969 "default_match_strategy": "fieldMatchUnknown", 970 "reserved_match_strategy": "fieldMatchReserved", 971 "default_data_type": "dataTypeUnknown", 972 "expr_data_type": "dataTypeListStr", 973 "input_data_type": "dataTypeStr", 974 "values": []string{`barfoo`, `foobar`}, 975 }, 976 }, { 977 name: "failed regex match an input string against a list of strings in realm field", 978 condition: `regex match realm barfoo (foobar|raboff`, 979 shouldErr: true, 980 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 981 }, {name: "regex match an input string against a string condition in realm field", 982 condition: `regex match realm foobar`, 983 want: map[string]interface{}{ 984 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 985 "field_name": "realm", 986 "regex_enabled": true, 987 "match_strategy": "fieldMatchRegex", 988 "always_true": false, 989 "default_match_strategy": "fieldMatchUnknown", 990 "reserved_match_strategy": "fieldMatchReserved", 991 "default_data_type": "dataTypeUnknown", 992 "expr_data_type": "dataTypeStr", 993 "input_data_type": "dataTypeStr", 994 "values": []string{`foobar`}, 995 }, 996 }, { 997 name: "failed regex match an input string against a string condition in realm field", 998 condition: `regex match realm foobar|raboff)`, 999 shouldErr: true, 1000 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1001 }, {name: "exact match a list of strings input against a list of strings in aud field", 1002 condition: `exact match aud barfoo foobar`, 1003 want: map[string]interface{}{ 1004 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1005 "field_name": "aud", 1006 "regex_enabled": false, 1007 "match_strategy": "fieldMatchExact", 1008 "always_true": false, 1009 "default_match_strategy": "fieldMatchUnknown", 1010 "reserved_match_strategy": "fieldMatchReserved", 1011 "default_data_type": "dataTypeUnknown", 1012 "expr_data_type": "dataTypeListStr", 1013 "input_data_type": "dataTypeListStr", 1014 "values": []string{`barfoo`, `foobar`}, 1015 }, 1016 }, {name: "default match a list of strings input against a list of strings in aud field", 1017 condition: ` match aud barfoo foobar`, 1018 want: map[string]interface{}{ 1019 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1020 "field_name": "aud", 1021 "regex_enabled": false, 1022 "match_strategy": "fieldMatchExact", 1023 "always_true": false, 1024 "default_match_strategy": "fieldMatchUnknown", 1025 "reserved_match_strategy": "fieldMatchReserved", 1026 "default_data_type": "dataTypeUnknown", 1027 "expr_data_type": "dataTypeListStr", 1028 "input_data_type": "dataTypeListStr", 1029 "values": []string{`barfoo`, `foobar`}, 1030 }, 1031 }, {name: "exact match a list of strings input against a string condition in aud field", 1032 condition: `exact match aud foobar`, 1033 want: map[string]interface{}{ 1034 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1035 "field_name": "aud", 1036 "regex_enabled": false, 1037 "match_strategy": "fieldMatchExact", 1038 "always_true": false, 1039 "default_match_strategy": "fieldMatchUnknown", 1040 "reserved_match_strategy": "fieldMatchReserved", 1041 "default_data_type": "dataTypeUnknown", 1042 "expr_data_type": "dataTypeStr", 1043 "input_data_type": "dataTypeListStr", 1044 "values": []string{`foobar`}, 1045 }, 1046 }, {name: "default match a list of strings input against a string condition in aud field", 1047 condition: ` match aud foobar`, 1048 want: map[string]interface{}{ 1049 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1050 "field_name": "aud", 1051 "regex_enabled": false, 1052 "match_strategy": "fieldMatchExact", 1053 "always_true": false, 1054 "default_match_strategy": "fieldMatchUnknown", 1055 "reserved_match_strategy": "fieldMatchReserved", 1056 "default_data_type": "dataTypeUnknown", 1057 "expr_data_type": "dataTypeStr", 1058 "input_data_type": "dataTypeListStr", 1059 "values": []string{`foobar`}, 1060 }, 1061 }, {name: "partial match a list of strings input against a list of strings in aud field", 1062 condition: `partial match aud barfoo foobar`, 1063 want: map[string]interface{}{ 1064 "condition_type": "*acl.ruleListStrCondPartialMatchListStrInput", 1065 "field_name": "aud", 1066 "regex_enabled": false, 1067 "match_strategy": "fieldMatchPartial", 1068 "always_true": false, 1069 "default_match_strategy": "fieldMatchUnknown", 1070 "reserved_match_strategy": "fieldMatchReserved", 1071 "default_data_type": "dataTypeUnknown", 1072 "expr_data_type": "dataTypeListStr", 1073 "input_data_type": "dataTypeListStr", 1074 "values": []string{`barfoo`, `foobar`}, 1075 }, 1076 }, {name: "partial match a list of strings input against a string condition in aud field", 1077 condition: `partial match aud foobar`, 1078 want: map[string]interface{}{ 1079 "condition_type": "*acl.ruleStrCondPartialMatchListStrInput", 1080 "field_name": "aud", 1081 "regex_enabled": false, 1082 "match_strategy": "fieldMatchPartial", 1083 "always_true": false, 1084 "default_match_strategy": "fieldMatchUnknown", 1085 "reserved_match_strategy": "fieldMatchReserved", 1086 "default_data_type": "dataTypeUnknown", 1087 "expr_data_type": "dataTypeStr", 1088 "input_data_type": "dataTypeListStr", 1089 "values": []string{`foobar`}, 1090 }, 1091 }, {name: "prefix match a list of strings input against a list of strings in aud field", 1092 condition: `prefix match aud barfoo foobar`, 1093 want: map[string]interface{}{ 1094 "condition_type": "*acl.ruleListStrCondPrefixMatchListStrInput", 1095 "field_name": "aud", 1096 "regex_enabled": false, 1097 "match_strategy": "fieldMatchPrefix", 1098 "always_true": false, 1099 "default_match_strategy": "fieldMatchUnknown", 1100 "reserved_match_strategy": "fieldMatchReserved", 1101 "default_data_type": "dataTypeUnknown", 1102 "expr_data_type": "dataTypeListStr", 1103 "input_data_type": "dataTypeListStr", 1104 "values": []string{`barfoo`, `foobar`}, 1105 }, 1106 }, {name: "prefix match a list of strings input against a string condition in aud field", 1107 condition: `prefix match aud foobar`, 1108 want: map[string]interface{}{ 1109 "condition_type": "*acl.ruleStrCondPrefixMatchListStrInput", 1110 "field_name": "aud", 1111 "regex_enabled": false, 1112 "match_strategy": "fieldMatchPrefix", 1113 "always_true": false, 1114 "default_match_strategy": "fieldMatchUnknown", 1115 "reserved_match_strategy": "fieldMatchReserved", 1116 "default_data_type": "dataTypeUnknown", 1117 "expr_data_type": "dataTypeStr", 1118 "input_data_type": "dataTypeListStr", 1119 "values": []string{`foobar`}, 1120 }, 1121 }, {name: "suffix match a list of strings input against a list of strings in aud field", 1122 condition: `suffix match aud barfoo foobar`, 1123 want: map[string]interface{}{ 1124 "condition_type": "*acl.ruleListStrCondSuffixMatchListStrInput", 1125 "field_name": "aud", 1126 "regex_enabled": false, 1127 "match_strategy": "fieldMatchSuffix", 1128 "always_true": false, 1129 "default_match_strategy": "fieldMatchUnknown", 1130 "reserved_match_strategy": "fieldMatchReserved", 1131 "default_data_type": "dataTypeUnknown", 1132 "expr_data_type": "dataTypeListStr", 1133 "input_data_type": "dataTypeListStr", 1134 "values": []string{`barfoo`, `foobar`}, 1135 }, 1136 }, {name: "suffix match a list of strings input against a string condition in aud field", 1137 condition: `suffix match aud foobar`, 1138 want: map[string]interface{}{ 1139 "condition_type": "*acl.ruleStrCondSuffixMatchListStrInput", 1140 "field_name": "aud", 1141 "regex_enabled": false, 1142 "match_strategy": "fieldMatchSuffix", 1143 "always_true": false, 1144 "default_match_strategy": "fieldMatchUnknown", 1145 "reserved_match_strategy": "fieldMatchReserved", 1146 "default_data_type": "dataTypeUnknown", 1147 "expr_data_type": "dataTypeStr", 1148 "input_data_type": "dataTypeListStr", 1149 "values": []string{`foobar`}, 1150 }, 1151 }, {name: "regex match a list of strings input against a list of strings in aud field", 1152 condition: `regex match aud barfoo foobar`, 1153 want: map[string]interface{}{ 1154 "condition_type": "*acl.ruleListStrCondRegexMatchListStrInput", 1155 "field_name": "aud", 1156 "regex_enabled": true, 1157 "match_strategy": "fieldMatchRegex", 1158 "always_true": false, 1159 "default_match_strategy": "fieldMatchUnknown", 1160 "reserved_match_strategy": "fieldMatchReserved", 1161 "default_data_type": "dataTypeUnknown", 1162 "expr_data_type": "dataTypeListStr", 1163 "input_data_type": "dataTypeListStr", 1164 "values": []string{`barfoo`, `foobar`}, 1165 }, 1166 }, { 1167 name: "failed regex match a list of strings input against a list of strings in aud field", 1168 condition: `regex match aud barfoo (foobar|raboff`, 1169 shouldErr: true, 1170 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 1171 }, {name: "regex match a list of strings input against a string condition in aud field", 1172 condition: `regex match aud foobar`, 1173 want: map[string]interface{}{ 1174 "condition_type": "*acl.ruleStrCondRegexMatchListStrInput", 1175 "field_name": "aud", 1176 "regex_enabled": true, 1177 "match_strategy": "fieldMatchRegex", 1178 "always_true": false, 1179 "default_match_strategy": "fieldMatchUnknown", 1180 "reserved_match_strategy": "fieldMatchReserved", 1181 "default_data_type": "dataTypeUnknown", 1182 "expr_data_type": "dataTypeStr", 1183 "input_data_type": "dataTypeListStr", 1184 "values": []string{`foobar`}, 1185 }, 1186 }, { 1187 name: "failed regex match a list of strings input against a string condition in aud field", 1188 condition: `regex match aud foobar|raboff)`, 1189 shouldErr: true, 1190 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1191 }, {name: "exact match a list of strings input against a list of strings in scopes field", 1192 condition: `exact match scopes barfoo foobar`, 1193 want: map[string]interface{}{ 1194 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1195 "field_name": "scopes", 1196 "regex_enabled": false, 1197 "match_strategy": "fieldMatchExact", 1198 "always_true": false, 1199 "default_match_strategy": "fieldMatchUnknown", 1200 "reserved_match_strategy": "fieldMatchReserved", 1201 "default_data_type": "dataTypeUnknown", 1202 "expr_data_type": "dataTypeListStr", 1203 "input_data_type": "dataTypeListStr", 1204 "values": []string{`barfoo`, `foobar`}, 1205 }, 1206 }, {name: "default match a list of strings input against a list of strings in scopes field", 1207 condition: ` match scopes barfoo foobar`, 1208 want: map[string]interface{}{ 1209 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1210 "field_name": "scopes", 1211 "regex_enabled": false, 1212 "match_strategy": "fieldMatchExact", 1213 "always_true": false, 1214 "default_match_strategy": "fieldMatchUnknown", 1215 "reserved_match_strategy": "fieldMatchReserved", 1216 "default_data_type": "dataTypeUnknown", 1217 "expr_data_type": "dataTypeListStr", 1218 "input_data_type": "dataTypeListStr", 1219 "values": []string{`barfoo`, `foobar`}, 1220 }, 1221 }, {name: "exact match a list of strings input against a string condition in scopes field", 1222 condition: `exact match scopes foobar`, 1223 want: map[string]interface{}{ 1224 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1225 "field_name": "scopes", 1226 "regex_enabled": false, 1227 "match_strategy": "fieldMatchExact", 1228 "always_true": false, 1229 "default_match_strategy": "fieldMatchUnknown", 1230 "reserved_match_strategy": "fieldMatchReserved", 1231 "default_data_type": "dataTypeUnknown", 1232 "expr_data_type": "dataTypeStr", 1233 "input_data_type": "dataTypeListStr", 1234 "values": []string{`foobar`}, 1235 }, 1236 }, {name: "default match a list of strings input against a string condition in scopes field", 1237 condition: ` match scopes foobar`, 1238 want: map[string]interface{}{ 1239 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1240 "field_name": "scopes", 1241 "regex_enabled": false, 1242 "match_strategy": "fieldMatchExact", 1243 "always_true": false, 1244 "default_match_strategy": "fieldMatchUnknown", 1245 "reserved_match_strategy": "fieldMatchReserved", 1246 "default_data_type": "dataTypeUnknown", 1247 "expr_data_type": "dataTypeStr", 1248 "input_data_type": "dataTypeListStr", 1249 "values": []string{`foobar`}, 1250 }, 1251 }, {name: "partial match a list of strings input against a list of strings in scopes field", 1252 condition: `partial match scopes barfoo foobar`, 1253 want: map[string]interface{}{ 1254 "condition_type": "*acl.ruleListStrCondPartialMatchListStrInput", 1255 "field_name": "scopes", 1256 "regex_enabled": false, 1257 "match_strategy": "fieldMatchPartial", 1258 "always_true": false, 1259 "default_match_strategy": "fieldMatchUnknown", 1260 "reserved_match_strategy": "fieldMatchReserved", 1261 "default_data_type": "dataTypeUnknown", 1262 "expr_data_type": "dataTypeListStr", 1263 "input_data_type": "dataTypeListStr", 1264 "values": []string{`barfoo`, `foobar`}, 1265 }, 1266 }, {name: "partial match a list of strings input against a string condition in scopes field", 1267 condition: `partial match scopes foobar`, 1268 want: map[string]interface{}{ 1269 "condition_type": "*acl.ruleStrCondPartialMatchListStrInput", 1270 "field_name": "scopes", 1271 "regex_enabled": false, 1272 "match_strategy": "fieldMatchPartial", 1273 "always_true": false, 1274 "default_match_strategy": "fieldMatchUnknown", 1275 "reserved_match_strategy": "fieldMatchReserved", 1276 "default_data_type": "dataTypeUnknown", 1277 "expr_data_type": "dataTypeStr", 1278 "input_data_type": "dataTypeListStr", 1279 "values": []string{`foobar`}, 1280 }, 1281 }, {name: "prefix match a list of strings input against a list of strings in scopes field", 1282 condition: `prefix match scopes barfoo foobar`, 1283 want: map[string]interface{}{ 1284 "condition_type": "*acl.ruleListStrCondPrefixMatchListStrInput", 1285 "field_name": "scopes", 1286 "regex_enabled": false, 1287 "match_strategy": "fieldMatchPrefix", 1288 "always_true": false, 1289 "default_match_strategy": "fieldMatchUnknown", 1290 "reserved_match_strategy": "fieldMatchReserved", 1291 "default_data_type": "dataTypeUnknown", 1292 "expr_data_type": "dataTypeListStr", 1293 "input_data_type": "dataTypeListStr", 1294 "values": []string{`barfoo`, `foobar`}, 1295 }, 1296 }, {name: "prefix match a list of strings input against a string condition in scopes field", 1297 condition: `prefix match scopes foobar`, 1298 want: map[string]interface{}{ 1299 "condition_type": "*acl.ruleStrCondPrefixMatchListStrInput", 1300 "field_name": "scopes", 1301 "regex_enabled": false, 1302 "match_strategy": "fieldMatchPrefix", 1303 "always_true": false, 1304 "default_match_strategy": "fieldMatchUnknown", 1305 "reserved_match_strategy": "fieldMatchReserved", 1306 "default_data_type": "dataTypeUnknown", 1307 "expr_data_type": "dataTypeStr", 1308 "input_data_type": "dataTypeListStr", 1309 "values": []string{`foobar`}, 1310 }, 1311 }, {name: "suffix match a list of strings input against a list of strings in scopes field", 1312 condition: `suffix match scopes barfoo foobar`, 1313 want: map[string]interface{}{ 1314 "condition_type": "*acl.ruleListStrCondSuffixMatchListStrInput", 1315 "field_name": "scopes", 1316 "regex_enabled": false, 1317 "match_strategy": "fieldMatchSuffix", 1318 "always_true": false, 1319 "default_match_strategy": "fieldMatchUnknown", 1320 "reserved_match_strategy": "fieldMatchReserved", 1321 "default_data_type": "dataTypeUnknown", 1322 "expr_data_type": "dataTypeListStr", 1323 "input_data_type": "dataTypeListStr", 1324 "values": []string{`barfoo`, `foobar`}, 1325 }, 1326 }, {name: "suffix match a list of strings input against a string condition in scopes field", 1327 condition: `suffix match scopes foobar`, 1328 want: map[string]interface{}{ 1329 "condition_type": "*acl.ruleStrCondSuffixMatchListStrInput", 1330 "field_name": "scopes", 1331 "regex_enabled": false, 1332 "match_strategy": "fieldMatchSuffix", 1333 "always_true": false, 1334 "default_match_strategy": "fieldMatchUnknown", 1335 "reserved_match_strategy": "fieldMatchReserved", 1336 "default_data_type": "dataTypeUnknown", 1337 "expr_data_type": "dataTypeStr", 1338 "input_data_type": "dataTypeListStr", 1339 "values": []string{`foobar`}, 1340 }, 1341 }, {name: "regex match a list of strings input against a list of strings in scopes field", 1342 condition: `regex match scopes barfoo foobar`, 1343 want: map[string]interface{}{ 1344 "condition_type": "*acl.ruleListStrCondRegexMatchListStrInput", 1345 "field_name": "scopes", 1346 "regex_enabled": true, 1347 "match_strategy": "fieldMatchRegex", 1348 "always_true": false, 1349 "default_match_strategy": "fieldMatchUnknown", 1350 "reserved_match_strategy": "fieldMatchReserved", 1351 "default_data_type": "dataTypeUnknown", 1352 "expr_data_type": "dataTypeListStr", 1353 "input_data_type": "dataTypeListStr", 1354 "values": []string{`barfoo`, `foobar`}, 1355 }, 1356 }, { 1357 name: "failed regex match a list of strings input against a list of strings in scopes field", 1358 condition: `regex match scopes barfoo (foobar|raboff`, 1359 shouldErr: true, 1360 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 1361 }, {name: "regex match a list of strings input against a string condition in scopes field", 1362 condition: `regex match scopes foobar`, 1363 want: map[string]interface{}{ 1364 "condition_type": "*acl.ruleStrCondRegexMatchListStrInput", 1365 "field_name": "scopes", 1366 "regex_enabled": true, 1367 "match_strategy": "fieldMatchRegex", 1368 "always_true": false, 1369 "default_match_strategy": "fieldMatchUnknown", 1370 "reserved_match_strategy": "fieldMatchReserved", 1371 "default_data_type": "dataTypeUnknown", 1372 "expr_data_type": "dataTypeStr", 1373 "input_data_type": "dataTypeListStr", 1374 "values": []string{`foobar`}, 1375 }, 1376 }, { 1377 name: "failed regex match a list of strings input against a string condition in scopes field", 1378 condition: `regex match scopes foobar|raboff)`, 1379 shouldErr: true, 1380 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1381 }, {name: "exact match a list of strings input against a list of strings in org field", 1382 condition: `exact match org barfoo foobar`, 1383 want: map[string]interface{}{ 1384 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1385 "field_name": "org", 1386 "regex_enabled": false, 1387 "match_strategy": "fieldMatchExact", 1388 "always_true": false, 1389 "default_match_strategy": "fieldMatchUnknown", 1390 "reserved_match_strategy": "fieldMatchReserved", 1391 "default_data_type": "dataTypeUnknown", 1392 "expr_data_type": "dataTypeListStr", 1393 "input_data_type": "dataTypeListStr", 1394 "values": []string{`barfoo`, `foobar`}, 1395 }, 1396 }, {name: "default match a list of strings input against a list of strings in org field", 1397 condition: ` match org barfoo foobar`, 1398 want: map[string]interface{}{ 1399 "condition_type": "*acl.ruleListStrCondExactMatchListStrInput", 1400 "field_name": "org", 1401 "regex_enabled": false, 1402 "match_strategy": "fieldMatchExact", 1403 "always_true": false, 1404 "default_match_strategy": "fieldMatchUnknown", 1405 "reserved_match_strategy": "fieldMatchReserved", 1406 "default_data_type": "dataTypeUnknown", 1407 "expr_data_type": "dataTypeListStr", 1408 "input_data_type": "dataTypeListStr", 1409 "values": []string{`barfoo`, `foobar`}, 1410 }, 1411 }, {name: "exact match a list of strings input against a string condition in org field", 1412 condition: `exact match org foobar`, 1413 want: map[string]interface{}{ 1414 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1415 "field_name": "org", 1416 "regex_enabled": false, 1417 "match_strategy": "fieldMatchExact", 1418 "always_true": false, 1419 "default_match_strategy": "fieldMatchUnknown", 1420 "reserved_match_strategy": "fieldMatchReserved", 1421 "default_data_type": "dataTypeUnknown", 1422 "expr_data_type": "dataTypeStr", 1423 "input_data_type": "dataTypeListStr", 1424 "values": []string{`foobar`}, 1425 }, 1426 }, {name: "default match a list of strings input against a string condition in org field", 1427 condition: ` match org foobar`, 1428 want: map[string]interface{}{ 1429 "condition_type": "*acl.ruleStrCondExactMatchListStrInput", 1430 "field_name": "org", 1431 "regex_enabled": false, 1432 "match_strategy": "fieldMatchExact", 1433 "always_true": false, 1434 "default_match_strategy": "fieldMatchUnknown", 1435 "reserved_match_strategy": "fieldMatchReserved", 1436 "default_data_type": "dataTypeUnknown", 1437 "expr_data_type": "dataTypeStr", 1438 "input_data_type": "dataTypeListStr", 1439 "values": []string{`foobar`}, 1440 }, 1441 }, {name: "partial match a list of strings input against a list of strings in org field", 1442 condition: `partial match org barfoo foobar`, 1443 want: map[string]interface{}{ 1444 "condition_type": "*acl.ruleListStrCondPartialMatchListStrInput", 1445 "field_name": "org", 1446 "regex_enabled": false, 1447 "match_strategy": "fieldMatchPartial", 1448 "always_true": false, 1449 "default_match_strategy": "fieldMatchUnknown", 1450 "reserved_match_strategy": "fieldMatchReserved", 1451 "default_data_type": "dataTypeUnknown", 1452 "expr_data_type": "dataTypeListStr", 1453 "input_data_type": "dataTypeListStr", 1454 "values": []string{`barfoo`, `foobar`}, 1455 }, 1456 }, {name: "partial match a list of strings input against a string condition in org field", 1457 condition: `partial match org foobar`, 1458 want: map[string]interface{}{ 1459 "condition_type": "*acl.ruleStrCondPartialMatchListStrInput", 1460 "field_name": "org", 1461 "regex_enabled": false, 1462 "match_strategy": "fieldMatchPartial", 1463 "always_true": false, 1464 "default_match_strategy": "fieldMatchUnknown", 1465 "reserved_match_strategy": "fieldMatchReserved", 1466 "default_data_type": "dataTypeUnknown", 1467 "expr_data_type": "dataTypeStr", 1468 "input_data_type": "dataTypeListStr", 1469 "values": []string{`foobar`}, 1470 }, 1471 }, {name: "prefix match a list of strings input against a list of strings in org field", 1472 condition: `prefix match org barfoo foobar`, 1473 want: map[string]interface{}{ 1474 "condition_type": "*acl.ruleListStrCondPrefixMatchListStrInput", 1475 "field_name": "org", 1476 "regex_enabled": false, 1477 "match_strategy": "fieldMatchPrefix", 1478 "always_true": false, 1479 "default_match_strategy": "fieldMatchUnknown", 1480 "reserved_match_strategy": "fieldMatchReserved", 1481 "default_data_type": "dataTypeUnknown", 1482 "expr_data_type": "dataTypeListStr", 1483 "input_data_type": "dataTypeListStr", 1484 "values": []string{`barfoo`, `foobar`}, 1485 }, 1486 }, {name: "prefix match a list of strings input against a string condition in org field", 1487 condition: `prefix match org foobar`, 1488 want: map[string]interface{}{ 1489 "condition_type": "*acl.ruleStrCondPrefixMatchListStrInput", 1490 "field_name": "org", 1491 "regex_enabled": false, 1492 "match_strategy": "fieldMatchPrefix", 1493 "always_true": false, 1494 "default_match_strategy": "fieldMatchUnknown", 1495 "reserved_match_strategy": "fieldMatchReserved", 1496 "default_data_type": "dataTypeUnknown", 1497 "expr_data_type": "dataTypeStr", 1498 "input_data_type": "dataTypeListStr", 1499 "values": []string{`foobar`}, 1500 }, 1501 }, {name: "suffix match a list of strings input against a list of strings in org field", 1502 condition: `suffix match org barfoo foobar`, 1503 want: map[string]interface{}{ 1504 "condition_type": "*acl.ruleListStrCondSuffixMatchListStrInput", 1505 "field_name": "org", 1506 "regex_enabled": false, 1507 "match_strategy": "fieldMatchSuffix", 1508 "always_true": false, 1509 "default_match_strategy": "fieldMatchUnknown", 1510 "reserved_match_strategy": "fieldMatchReserved", 1511 "default_data_type": "dataTypeUnknown", 1512 "expr_data_type": "dataTypeListStr", 1513 "input_data_type": "dataTypeListStr", 1514 "values": []string{`barfoo`, `foobar`}, 1515 }, 1516 }, {name: "suffix match a list of strings input against a string condition in org field", 1517 condition: `suffix match org foobar`, 1518 want: map[string]interface{}{ 1519 "condition_type": "*acl.ruleStrCondSuffixMatchListStrInput", 1520 "field_name": "org", 1521 "regex_enabled": false, 1522 "match_strategy": "fieldMatchSuffix", 1523 "always_true": false, 1524 "default_match_strategy": "fieldMatchUnknown", 1525 "reserved_match_strategy": "fieldMatchReserved", 1526 "default_data_type": "dataTypeUnknown", 1527 "expr_data_type": "dataTypeStr", 1528 "input_data_type": "dataTypeListStr", 1529 "values": []string{`foobar`}, 1530 }, 1531 }, {name: "regex match a list of strings input against a list of strings in org field", 1532 condition: `regex match org barfoo foobar`, 1533 want: map[string]interface{}{ 1534 "condition_type": "*acl.ruleListStrCondRegexMatchListStrInput", 1535 "field_name": "org", 1536 "regex_enabled": true, 1537 "match_strategy": "fieldMatchRegex", 1538 "always_true": false, 1539 "default_match_strategy": "fieldMatchUnknown", 1540 "reserved_match_strategy": "fieldMatchReserved", 1541 "default_data_type": "dataTypeUnknown", 1542 "expr_data_type": "dataTypeListStr", 1543 "input_data_type": "dataTypeListStr", 1544 "values": []string{`barfoo`, `foobar`}, 1545 }, 1546 }, { 1547 name: "failed regex match a list of strings input against a list of strings in org field", 1548 condition: `regex match org barfoo (foobar|raboff`, 1549 shouldErr: true, 1550 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 1551 }, {name: "regex match a list of strings input against a string condition in org field", 1552 condition: `regex match org foobar`, 1553 want: map[string]interface{}{ 1554 "condition_type": "*acl.ruleStrCondRegexMatchListStrInput", 1555 "field_name": "org", 1556 "regex_enabled": true, 1557 "match_strategy": "fieldMatchRegex", 1558 "always_true": false, 1559 "default_match_strategy": "fieldMatchUnknown", 1560 "reserved_match_strategy": "fieldMatchReserved", 1561 "default_data_type": "dataTypeUnknown", 1562 "expr_data_type": "dataTypeStr", 1563 "input_data_type": "dataTypeListStr", 1564 "values": []string{`foobar`}, 1565 }, 1566 }, { 1567 name: "failed regex match a list of strings input against a string condition in org field", 1568 condition: `regex match org foobar|raboff)`, 1569 shouldErr: true, 1570 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1571 }, {name: "exact match an input string against a list of strings in jti field", 1572 condition: `exact match jti barfoo foobar`, 1573 want: map[string]interface{}{ 1574 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1575 "field_name": "jti", 1576 "regex_enabled": false, 1577 "match_strategy": "fieldMatchExact", 1578 "always_true": false, 1579 "default_match_strategy": "fieldMatchUnknown", 1580 "reserved_match_strategy": "fieldMatchReserved", 1581 "default_data_type": "dataTypeUnknown", 1582 "expr_data_type": "dataTypeListStr", 1583 "input_data_type": "dataTypeStr", 1584 "values": []string{`barfoo`, `foobar`}, 1585 }, 1586 }, {name: "default match an input string against a list of strings in jti field", 1587 condition: ` match jti barfoo foobar`, 1588 want: map[string]interface{}{ 1589 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1590 "field_name": "jti", 1591 "regex_enabled": false, 1592 "match_strategy": "fieldMatchExact", 1593 "always_true": false, 1594 "default_match_strategy": "fieldMatchUnknown", 1595 "reserved_match_strategy": "fieldMatchReserved", 1596 "default_data_type": "dataTypeUnknown", 1597 "expr_data_type": "dataTypeListStr", 1598 "input_data_type": "dataTypeStr", 1599 "values": []string{`barfoo`, `foobar`}, 1600 }, 1601 }, {name: "exact match an input string against a string condition in jti field", 1602 condition: `exact match jti foobar`, 1603 want: map[string]interface{}{ 1604 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 1605 "field_name": "jti", 1606 "regex_enabled": false, 1607 "match_strategy": "fieldMatchExact", 1608 "always_true": false, 1609 "default_match_strategy": "fieldMatchUnknown", 1610 "reserved_match_strategy": "fieldMatchReserved", 1611 "default_data_type": "dataTypeUnknown", 1612 "expr_data_type": "dataTypeStr", 1613 "input_data_type": "dataTypeStr", 1614 "values": []string{`foobar`}, 1615 }, 1616 }, {name: "default match an input string against a string condition in jti field", 1617 condition: ` match jti foobar`, 1618 want: map[string]interface{}{ 1619 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 1620 "field_name": "jti", 1621 "regex_enabled": false, 1622 "match_strategy": "fieldMatchExact", 1623 "always_true": false, 1624 "default_match_strategy": "fieldMatchUnknown", 1625 "reserved_match_strategy": "fieldMatchReserved", 1626 "default_data_type": "dataTypeUnknown", 1627 "expr_data_type": "dataTypeStr", 1628 "input_data_type": "dataTypeStr", 1629 "values": []string{`foobar`}, 1630 }, 1631 }, {name: "partial match an input string against a list of strings in jti field", 1632 condition: `partial match jti barfoo foobar`, 1633 want: map[string]interface{}{ 1634 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 1635 "field_name": "jti", 1636 "regex_enabled": false, 1637 "match_strategy": "fieldMatchPartial", 1638 "always_true": false, 1639 "default_match_strategy": "fieldMatchUnknown", 1640 "reserved_match_strategy": "fieldMatchReserved", 1641 "default_data_type": "dataTypeUnknown", 1642 "expr_data_type": "dataTypeListStr", 1643 "input_data_type": "dataTypeStr", 1644 "values": []string{`barfoo`, `foobar`}, 1645 }, 1646 }, {name: "partial match an input string against a string condition in jti field", 1647 condition: `partial match jti foobar`, 1648 want: map[string]interface{}{ 1649 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 1650 "field_name": "jti", 1651 "regex_enabled": false, 1652 "match_strategy": "fieldMatchPartial", 1653 "always_true": false, 1654 "default_match_strategy": "fieldMatchUnknown", 1655 "reserved_match_strategy": "fieldMatchReserved", 1656 "default_data_type": "dataTypeUnknown", 1657 "expr_data_type": "dataTypeStr", 1658 "input_data_type": "dataTypeStr", 1659 "values": []string{`foobar`}, 1660 }, 1661 }, {name: "prefix match an input string against a list of strings in jti field", 1662 condition: `prefix match jti barfoo foobar`, 1663 want: map[string]interface{}{ 1664 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 1665 "field_name": "jti", 1666 "regex_enabled": false, 1667 "match_strategy": "fieldMatchPrefix", 1668 "always_true": false, 1669 "default_match_strategy": "fieldMatchUnknown", 1670 "reserved_match_strategy": "fieldMatchReserved", 1671 "default_data_type": "dataTypeUnknown", 1672 "expr_data_type": "dataTypeListStr", 1673 "input_data_type": "dataTypeStr", 1674 "values": []string{`barfoo`, `foobar`}, 1675 }, 1676 }, {name: "prefix match an input string against a string condition in jti field", 1677 condition: `prefix match jti foobar`, 1678 want: map[string]interface{}{ 1679 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 1680 "field_name": "jti", 1681 "regex_enabled": false, 1682 "match_strategy": "fieldMatchPrefix", 1683 "always_true": false, 1684 "default_match_strategy": "fieldMatchUnknown", 1685 "reserved_match_strategy": "fieldMatchReserved", 1686 "default_data_type": "dataTypeUnknown", 1687 "expr_data_type": "dataTypeStr", 1688 "input_data_type": "dataTypeStr", 1689 "values": []string{`foobar`}, 1690 }, 1691 }, {name: "suffix match an input string against a list of strings in jti field", 1692 condition: `suffix match jti barfoo foobar`, 1693 want: map[string]interface{}{ 1694 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 1695 "field_name": "jti", 1696 "regex_enabled": false, 1697 "match_strategy": "fieldMatchSuffix", 1698 "always_true": false, 1699 "default_match_strategy": "fieldMatchUnknown", 1700 "reserved_match_strategy": "fieldMatchReserved", 1701 "default_data_type": "dataTypeUnknown", 1702 "expr_data_type": "dataTypeListStr", 1703 "input_data_type": "dataTypeStr", 1704 "values": []string{`barfoo`, `foobar`}, 1705 }, 1706 }, {name: "suffix match an input string against a string condition in jti field", 1707 condition: `suffix match jti foobar`, 1708 want: map[string]interface{}{ 1709 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 1710 "field_name": "jti", 1711 "regex_enabled": false, 1712 "match_strategy": "fieldMatchSuffix", 1713 "always_true": false, 1714 "default_match_strategy": "fieldMatchUnknown", 1715 "reserved_match_strategy": "fieldMatchReserved", 1716 "default_data_type": "dataTypeUnknown", 1717 "expr_data_type": "dataTypeStr", 1718 "input_data_type": "dataTypeStr", 1719 "values": []string{`foobar`}, 1720 }, 1721 }, {name: "regex match an input string against a list of strings in jti field", 1722 condition: `regex match jti barfoo foobar`, 1723 want: map[string]interface{}{ 1724 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 1725 "field_name": "jti", 1726 "regex_enabled": true, 1727 "match_strategy": "fieldMatchRegex", 1728 "always_true": false, 1729 "default_match_strategy": "fieldMatchUnknown", 1730 "reserved_match_strategy": "fieldMatchReserved", 1731 "default_data_type": "dataTypeUnknown", 1732 "expr_data_type": "dataTypeListStr", 1733 "input_data_type": "dataTypeStr", 1734 "values": []string{`barfoo`, `foobar`}, 1735 }, 1736 }, { 1737 name: "failed regex match an input string against a list of strings in jti field", 1738 condition: `regex match jti barfoo (foobar|raboff`, 1739 shouldErr: true, 1740 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 1741 }, {name: "regex match an input string against a string condition in jti field", 1742 condition: `regex match jti foobar`, 1743 want: map[string]interface{}{ 1744 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 1745 "field_name": "jti", 1746 "regex_enabled": true, 1747 "match_strategy": "fieldMatchRegex", 1748 "always_true": false, 1749 "default_match_strategy": "fieldMatchUnknown", 1750 "reserved_match_strategy": "fieldMatchReserved", 1751 "default_data_type": "dataTypeUnknown", 1752 "expr_data_type": "dataTypeStr", 1753 "input_data_type": "dataTypeStr", 1754 "values": []string{`foobar`}, 1755 }, 1756 }, { 1757 name: "failed regex match an input string against a string condition in jti field", 1758 condition: `regex match jti foobar|raboff)`, 1759 shouldErr: true, 1760 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1761 }, {name: "exact match an input string against a list of strings in iss field", 1762 condition: `exact match iss barfoo foobar`, 1763 want: map[string]interface{}{ 1764 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1765 "field_name": "iss", 1766 "regex_enabled": false, 1767 "match_strategy": "fieldMatchExact", 1768 "always_true": false, 1769 "default_match_strategy": "fieldMatchUnknown", 1770 "reserved_match_strategy": "fieldMatchReserved", 1771 "default_data_type": "dataTypeUnknown", 1772 "expr_data_type": "dataTypeListStr", 1773 "input_data_type": "dataTypeStr", 1774 "values": []string{`barfoo`, `foobar`}, 1775 }, 1776 }, {name: "default match an input string against a list of strings in iss field", 1777 condition: ` match iss barfoo foobar`, 1778 want: map[string]interface{}{ 1779 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1780 "field_name": "iss", 1781 "regex_enabled": false, 1782 "match_strategy": "fieldMatchExact", 1783 "always_true": false, 1784 "default_match_strategy": "fieldMatchUnknown", 1785 "reserved_match_strategy": "fieldMatchReserved", 1786 "default_data_type": "dataTypeUnknown", 1787 "expr_data_type": "dataTypeListStr", 1788 "input_data_type": "dataTypeStr", 1789 "values": []string{`barfoo`, `foobar`}, 1790 }, 1791 }, {name: "exact match an input string against a string condition in iss field", 1792 condition: `exact match iss foobar`, 1793 want: map[string]interface{}{ 1794 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 1795 "field_name": "iss", 1796 "regex_enabled": false, 1797 "match_strategy": "fieldMatchExact", 1798 "always_true": false, 1799 "default_match_strategy": "fieldMatchUnknown", 1800 "reserved_match_strategy": "fieldMatchReserved", 1801 "default_data_type": "dataTypeUnknown", 1802 "expr_data_type": "dataTypeStr", 1803 "input_data_type": "dataTypeStr", 1804 "values": []string{`foobar`}, 1805 }, 1806 }, {name: "default match an input string against a string condition in iss field", 1807 condition: ` match iss foobar`, 1808 want: map[string]interface{}{ 1809 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 1810 "field_name": "iss", 1811 "regex_enabled": false, 1812 "match_strategy": "fieldMatchExact", 1813 "always_true": false, 1814 "default_match_strategy": "fieldMatchUnknown", 1815 "reserved_match_strategy": "fieldMatchReserved", 1816 "default_data_type": "dataTypeUnknown", 1817 "expr_data_type": "dataTypeStr", 1818 "input_data_type": "dataTypeStr", 1819 "values": []string{`foobar`}, 1820 }, 1821 }, {name: "partial match an input string against a list of strings in iss field", 1822 condition: `partial match iss barfoo foobar`, 1823 want: map[string]interface{}{ 1824 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 1825 "field_name": "iss", 1826 "regex_enabled": false, 1827 "match_strategy": "fieldMatchPartial", 1828 "always_true": false, 1829 "default_match_strategy": "fieldMatchUnknown", 1830 "reserved_match_strategy": "fieldMatchReserved", 1831 "default_data_type": "dataTypeUnknown", 1832 "expr_data_type": "dataTypeListStr", 1833 "input_data_type": "dataTypeStr", 1834 "values": []string{`barfoo`, `foobar`}, 1835 }, 1836 }, {name: "partial match an input string against a string condition in iss field", 1837 condition: `partial match iss foobar`, 1838 want: map[string]interface{}{ 1839 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 1840 "field_name": "iss", 1841 "regex_enabled": false, 1842 "match_strategy": "fieldMatchPartial", 1843 "always_true": false, 1844 "default_match_strategy": "fieldMatchUnknown", 1845 "reserved_match_strategy": "fieldMatchReserved", 1846 "default_data_type": "dataTypeUnknown", 1847 "expr_data_type": "dataTypeStr", 1848 "input_data_type": "dataTypeStr", 1849 "values": []string{`foobar`}, 1850 }, 1851 }, {name: "prefix match an input string against a list of strings in iss field", 1852 condition: `prefix match iss barfoo foobar`, 1853 want: map[string]interface{}{ 1854 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 1855 "field_name": "iss", 1856 "regex_enabled": false, 1857 "match_strategy": "fieldMatchPrefix", 1858 "always_true": false, 1859 "default_match_strategy": "fieldMatchUnknown", 1860 "reserved_match_strategy": "fieldMatchReserved", 1861 "default_data_type": "dataTypeUnknown", 1862 "expr_data_type": "dataTypeListStr", 1863 "input_data_type": "dataTypeStr", 1864 "values": []string{`barfoo`, `foobar`}, 1865 }, 1866 }, {name: "prefix match an input string against a string condition in iss field", 1867 condition: `prefix match iss foobar`, 1868 want: map[string]interface{}{ 1869 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 1870 "field_name": "iss", 1871 "regex_enabled": false, 1872 "match_strategy": "fieldMatchPrefix", 1873 "always_true": false, 1874 "default_match_strategy": "fieldMatchUnknown", 1875 "reserved_match_strategy": "fieldMatchReserved", 1876 "default_data_type": "dataTypeUnknown", 1877 "expr_data_type": "dataTypeStr", 1878 "input_data_type": "dataTypeStr", 1879 "values": []string{`foobar`}, 1880 }, 1881 }, {name: "suffix match an input string against a list of strings in iss field", 1882 condition: `suffix match iss barfoo foobar`, 1883 want: map[string]interface{}{ 1884 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 1885 "field_name": "iss", 1886 "regex_enabled": false, 1887 "match_strategy": "fieldMatchSuffix", 1888 "always_true": false, 1889 "default_match_strategy": "fieldMatchUnknown", 1890 "reserved_match_strategy": "fieldMatchReserved", 1891 "default_data_type": "dataTypeUnknown", 1892 "expr_data_type": "dataTypeListStr", 1893 "input_data_type": "dataTypeStr", 1894 "values": []string{`barfoo`, `foobar`}, 1895 }, 1896 }, {name: "suffix match an input string against a string condition in iss field", 1897 condition: `suffix match iss foobar`, 1898 want: map[string]interface{}{ 1899 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 1900 "field_name": "iss", 1901 "regex_enabled": false, 1902 "match_strategy": "fieldMatchSuffix", 1903 "always_true": false, 1904 "default_match_strategy": "fieldMatchUnknown", 1905 "reserved_match_strategy": "fieldMatchReserved", 1906 "default_data_type": "dataTypeUnknown", 1907 "expr_data_type": "dataTypeStr", 1908 "input_data_type": "dataTypeStr", 1909 "values": []string{`foobar`}, 1910 }, 1911 }, {name: "regex match an input string against a list of strings in iss field", 1912 condition: `regex match iss barfoo foobar`, 1913 want: map[string]interface{}{ 1914 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 1915 "field_name": "iss", 1916 "regex_enabled": true, 1917 "match_strategy": "fieldMatchRegex", 1918 "always_true": false, 1919 "default_match_strategy": "fieldMatchUnknown", 1920 "reserved_match_strategy": "fieldMatchReserved", 1921 "default_data_type": "dataTypeUnknown", 1922 "expr_data_type": "dataTypeListStr", 1923 "input_data_type": "dataTypeStr", 1924 "values": []string{`barfoo`, `foobar`}, 1925 }, 1926 }, { 1927 name: "failed regex match an input string against a list of strings in iss field", 1928 condition: `regex match iss barfoo (foobar|raboff`, 1929 shouldErr: true, 1930 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 1931 }, {name: "regex match an input string against a string condition in iss field", 1932 condition: `regex match iss foobar`, 1933 want: map[string]interface{}{ 1934 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 1935 "field_name": "iss", 1936 "regex_enabled": true, 1937 "match_strategy": "fieldMatchRegex", 1938 "always_true": false, 1939 "default_match_strategy": "fieldMatchUnknown", 1940 "reserved_match_strategy": "fieldMatchReserved", 1941 "default_data_type": "dataTypeUnknown", 1942 "expr_data_type": "dataTypeStr", 1943 "input_data_type": "dataTypeStr", 1944 "values": []string{`foobar`}, 1945 }, 1946 }, { 1947 name: "failed regex match an input string against a string condition in iss field", 1948 condition: `regex match iss foobar|raboff)`, 1949 shouldErr: true, 1950 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 1951 }, {name: "exact match an input string against a list of strings in sub field", 1952 condition: `exact match sub barfoo foobar`, 1953 want: map[string]interface{}{ 1954 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1955 "field_name": "sub", 1956 "regex_enabled": false, 1957 "match_strategy": "fieldMatchExact", 1958 "always_true": false, 1959 "default_match_strategy": "fieldMatchUnknown", 1960 "reserved_match_strategy": "fieldMatchReserved", 1961 "default_data_type": "dataTypeUnknown", 1962 "expr_data_type": "dataTypeListStr", 1963 "input_data_type": "dataTypeStr", 1964 "values": []string{`barfoo`, `foobar`}, 1965 }, 1966 }, {name: "default match an input string against a list of strings in sub field", 1967 condition: ` match sub barfoo foobar`, 1968 want: map[string]interface{}{ 1969 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 1970 "field_name": "sub", 1971 "regex_enabled": false, 1972 "match_strategy": "fieldMatchExact", 1973 "always_true": false, 1974 "default_match_strategy": "fieldMatchUnknown", 1975 "reserved_match_strategy": "fieldMatchReserved", 1976 "default_data_type": "dataTypeUnknown", 1977 "expr_data_type": "dataTypeListStr", 1978 "input_data_type": "dataTypeStr", 1979 "values": []string{`barfoo`, `foobar`}, 1980 }, 1981 }, {name: "exact match an input string against a string condition in sub field", 1982 condition: `exact match sub foobar`, 1983 want: map[string]interface{}{ 1984 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 1985 "field_name": "sub", 1986 "regex_enabled": false, 1987 "match_strategy": "fieldMatchExact", 1988 "always_true": false, 1989 "default_match_strategy": "fieldMatchUnknown", 1990 "reserved_match_strategy": "fieldMatchReserved", 1991 "default_data_type": "dataTypeUnknown", 1992 "expr_data_type": "dataTypeStr", 1993 "input_data_type": "dataTypeStr", 1994 "values": []string{`foobar`}, 1995 }, 1996 }, {name: "default match an input string against a string condition in sub field", 1997 condition: ` match sub foobar`, 1998 want: map[string]interface{}{ 1999 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2000 "field_name": "sub", 2001 "regex_enabled": false, 2002 "match_strategy": "fieldMatchExact", 2003 "always_true": false, 2004 "default_match_strategy": "fieldMatchUnknown", 2005 "reserved_match_strategy": "fieldMatchReserved", 2006 "default_data_type": "dataTypeUnknown", 2007 "expr_data_type": "dataTypeStr", 2008 "input_data_type": "dataTypeStr", 2009 "values": []string{`foobar`}, 2010 }, 2011 }, {name: "partial match an input string against a list of strings in sub field", 2012 condition: `partial match sub barfoo foobar`, 2013 want: map[string]interface{}{ 2014 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 2015 "field_name": "sub", 2016 "regex_enabled": false, 2017 "match_strategy": "fieldMatchPartial", 2018 "always_true": false, 2019 "default_match_strategy": "fieldMatchUnknown", 2020 "reserved_match_strategy": "fieldMatchReserved", 2021 "default_data_type": "dataTypeUnknown", 2022 "expr_data_type": "dataTypeListStr", 2023 "input_data_type": "dataTypeStr", 2024 "values": []string{`barfoo`, `foobar`}, 2025 }, 2026 }, {name: "partial match an input string against a string condition in sub field", 2027 condition: `partial match sub foobar`, 2028 want: map[string]interface{}{ 2029 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 2030 "field_name": "sub", 2031 "regex_enabled": false, 2032 "match_strategy": "fieldMatchPartial", 2033 "always_true": false, 2034 "default_match_strategy": "fieldMatchUnknown", 2035 "reserved_match_strategy": "fieldMatchReserved", 2036 "default_data_type": "dataTypeUnknown", 2037 "expr_data_type": "dataTypeStr", 2038 "input_data_type": "dataTypeStr", 2039 "values": []string{`foobar`}, 2040 }, 2041 }, {name: "prefix match an input string against a list of strings in sub field", 2042 condition: `prefix match sub barfoo foobar`, 2043 want: map[string]interface{}{ 2044 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 2045 "field_name": "sub", 2046 "regex_enabled": false, 2047 "match_strategy": "fieldMatchPrefix", 2048 "always_true": false, 2049 "default_match_strategy": "fieldMatchUnknown", 2050 "reserved_match_strategy": "fieldMatchReserved", 2051 "default_data_type": "dataTypeUnknown", 2052 "expr_data_type": "dataTypeListStr", 2053 "input_data_type": "dataTypeStr", 2054 "values": []string{`barfoo`, `foobar`}, 2055 }, 2056 }, {name: "prefix match an input string against a string condition in sub field", 2057 condition: `prefix match sub foobar`, 2058 want: map[string]interface{}{ 2059 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 2060 "field_name": "sub", 2061 "regex_enabled": false, 2062 "match_strategy": "fieldMatchPrefix", 2063 "always_true": false, 2064 "default_match_strategy": "fieldMatchUnknown", 2065 "reserved_match_strategy": "fieldMatchReserved", 2066 "default_data_type": "dataTypeUnknown", 2067 "expr_data_type": "dataTypeStr", 2068 "input_data_type": "dataTypeStr", 2069 "values": []string{`foobar`}, 2070 }, 2071 }, {name: "suffix match an input string against a list of strings in sub field", 2072 condition: `suffix match sub barfoo foobar`, 2073 want: map[string]interface{}{ 2074 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 2075 "field_name": "sub", 2076 "regex_enabled": false, 2077 "match_strategy": "fieldMatchSuffix", 2078 "always_true": false, 2079 "default_match_strategy": "fieldMatchUnknown", 2080 "reserved_match_strategy": "fieldMatchReserved", 2081 "default_data_type": "dataTypeUnknown", 2082 "expr_data_type": "dataTypeListStr", 2083 "input_data_type": "dataTypeStr", 2084 "values": []string{`barfoo`, `foobar`}, 2085 }, 2086 }, {name: "suffix match an input string against a string condition in sub field", 2087 condition: `suffix match sub foobar`, 2088 want: map[string]interface{}{ 2089 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 2090 "field_name": "sub", 2091 "regex_enabled": false, 2092 "match_strategy": "fieldMatchSuffix", 2093 "always_true": false, 2094 "default_match_strategy": "fieldMatchUnknown", 2095 "reserved_match_strategy": "fieldMatchReserved", 2096 "default_data_type": "dataTypeUnknown", 2097 "expr_data_type": "dataTypeStr", 2098 "input_data_type": "dataTypeStr", 2099 "values": []string{`foobar`}, 2100 }, 2101 }, {name: "regex match an input string against a list of strings in sub field", 2102 condition: `regex match sub barfoo foobar`, 2103 want: map[string]interface{}{ 2104 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 2105 "field_name": "sub", 2106 "regex_enabled": true, 2107 "match_strategy": "fieldMatchRegex", 2108 "always_true": false, 2109 "default_match_strategy": "fieldMatchUnknown", 2110 "reserved_match_strategy": "fieldMatchReserved", 2111 "default_data_type": "dataTypeUnknown", 2112 "expr_data_type": "dataTypeListStr", 2113 "input_data_type": "dataTypeStr", 2114 "values": []string{`barfoo`, `foobar`}, 2115 }, 2116 }, { 2117 name: "failed regex match an input string against a list of strings in sub field", 2118 condition: `regex match sub barfoo (foobar|raboff`, 2119 shouldErr: true, 2120 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 2121 }, {name: "regex match an input string against a string condition in sub field", 2122 condition: `regex match sub foobar`, 2123 want: map[string]interface{}{ 2124 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 2125 "field_name": "sub", 2126 "regex_enabled": true, 2127 "match_strategy": "fieldMatchRegex", 2128 "always_true": false, 2129 "default_match_strategy": "fieldMatchUnknown", 2130 "reserved_match_strategy": "fieldMatchReserved", 2131 "default_data_type": "dataTypeUnknown", 2132 "expr_data_type": "dataTypeStr", 2133 "input_data_type": "dataTypeStr", 2134 "values": []string{`foobar`}, 2135 }, 2136 }, { 2137 name: "failed regex match an input string against a string condition in sub field", 2138 condition: `regex match sub foobar|raboff)`, 2139 shouldErr: true, 2140 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 2141 }, {name: "exact match an input string against a list of strings in addr field", 2142 condition: `exact match addr barfoo foobar`, 2143 want: map[string]interface{}{ 2144 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2145 "field_name": "addr", 2146 "regex_enabled": false, 2147 "match_strategy": "fieldMatchExact", 2148 "always_true": false, 2149 "default_match_strategy": "fieldMatchUnknown", 2150 "reserved_match_strategy": "fieldMatchReserved", 2151 "default_data_type": "dataTypeUnknown", 2152 "expr_data_type": "dataTypeListStr", 2153 "input_data_type": "dataTypeStr", 2154 "values": []string{`barfoo`, `foobar`}, 2155 }, 2156 }, {name: "default match an input string against a list of strings in addr field", 2157 condition: ` match addr barfoo foobar`, 2158 want: map[string]interface{}{ 2159 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2160 "field_name": "addr", 2161 "regex_enabled": false, 2162 "match_strategy": "fieldMatchExact", 2163 "always_true": false, 2164 "default_match_strategy": "fieldMatchUnknown", 2165 "reserved_match_strategy": "fieldMatchReserved", 2166 "default_data_type": "dataTypeUnknown", 2167 "expr_data_type": "dataTypeListStr", 2168 "input_data_type": "dataTypeStr", 2169 "values": []string{`barfoo`, `foobar`}, 2170 }, 2171 }, {name: "exact match an input string against a string condition in addr field", 2172 condition: `exact match addr foobar`, 2173 want: map[string]interface{}{ 2174 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2175 "field_name": "addr", 2176 "regex_enabled": false, 2177 "match_strategy": "fieldMatchExact", 2178 "always_true": false, 2179 "default_match_strategy": "fieldMatchUnknown", 2180 "reserved_match_strategy": "fieldMatchReserved", 2181 "default_data_type": "dataTypeUnknown", 2182 "expr_data_type": "dataTypeStr", 2183 "input_data_type": "dataTypeStr", 2184 "values": []string{`foobar`}, 2185 }, 2186 }, {name: "default match an input string against a string condition in addr field", 2187 condition: ` match addr foobar`, 2188 want: map[string]interface{}{ 2189 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2190 "field_name": "addr", 2191 "regex_enabled": false, 2192 "match_strategy": "fieldMatchExact", 2193 "always_true": false, 2194 "default_match_strategy": "fieldMatchUnknown", 2195 "reserved_match_strategy": "fieldMatchReserved", 2196 "default_data_type": "dataTypeUnknown", 2197 "expr_data_type": "dataTypeStr", 2198 "input_data_type": "dataTypeStr", 2199 "values": []string{`foobar`}, 2200 }, 2201 }, {name: "partial match an input string against a list of strings in addr field", 2202 condition: `partial match addr barfoo foobar`, 2203 want: map[string]interface{}{ 2204 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 2205 "field_name": "addr", 2206 "regex_enabled": false, 2207 "match_strategy": "fieldMatchPartial", 2208 "always_true": false, 2209 "default_match_strategy": "fieldMatchUnknown", 2210 "reserved_match_strategy": "fieldMatchReserved", 2211 "default_data_type": "dataTypeUnknown", 2212 "expr_data_type": "dataTypeListStr", 2213 "input_data_type": "dataTypeStr", 2214 "values": []string{`barfoo`, `foobar`}, 2215 }, 2216 }, {name: "partial match an input string against a string condition in addr field", 2217 condition: `partial match addr foobar`, 2218 want: map[string]interface{}{ 2219 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 2220 "field_name": "addr", 2221 "regex_enabled": false, 2222 "match_strategy": "fieldMatchPartial", 2223 "always_true": false, 2224 "default_match_strategy": "fieldMatchUnknown", 2225 "reserved_match_strategy": "fieldMatchReserved", 2226 "default_data_type": "dataTypeUnknown", 2227 "expr_data_type": "dataTypeStr", 2228 "input_data_type": "dataTypeStr", 2229 "values": []string{`foobar`}, 2230 }, 2231 }, {name: "prefix match an input string against a list of strings in addr field", 2232 condition: `prefix match addr barfoo foobar`, 2233 want: map[string]interface{}{ 2234 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 2235 "field_name": "addr", 2236 "regex_enabled": false, 2237 "match_strategy": "fieldMatchPrefix", 2238 "always_true": false, 2239 "default_match_strategy": "fieldMatchUnknown", 2240 "reserved_match_strategy": "fieldMatchReserved", 2241 "default_data_type": "dataTypeUnknown", 2242 "expr_data_type": "dataTypeListStr", 2243 "input_data_type": "dataTypeStr", 2244 "values": []string{`barfoo`, `foobar`}, 2245 }, 2246 }, {name: "prefix match an input string against a string condition in addr field", 2247 condition: `prefix match addr foobar`, 2248 want: map[string]interface{}{ 2249 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 2250 "field_name": "addr", 2251 "regex_enabled": false, 2252 "match_strategy": "fieldMatchPrefix", 2253 "always_true": false, 2254 "default_match_strategy": "fieldMatchUnknown", 2255 "reserved_match_strategy": "fieldMatchReserved", 2256 "default_data_type": "dataTypeUnknown", 2257 "expr_data_type": "dataTypeStr", 2258 "input_data_type": "dataTypeStr", 2259 "values": []string{`foobar`}, 2260 }, 2261 }, {name: "suffix match an input string against a list of strings in addr field", 2262 condition: `suffix match addr barfoo foobar`, 2263 want: map[string]interface{}{ 2264 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 2265 "field_name": "addr", 2266 "regex_enabled": false, 2267 "match_strategy": "fieldMatchSuffix", 2268 "always_true": false, 2269 "default_match_strategy": "fieldMatchUnknown", 2270 "reserved_match_strategy": "fieldMatchReserved", 2271 "default_data_type": "dataTypeUnknown", 2272 "expr_data_type": "dataTypeListStr", 2273 "input_data_type": "dataTypeStr", 2274 "values": []string{`barfoo`, `foobar`}, 2275 }, 2276 }, {name: "suffix match an input string against a string condition in addr field", 2277 condition: `suffix match addr foobar`, 2278 want: map[string]interface{}{ 2279 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 2280 "field_name": "addr", 2281 "regex_enabled": false, 2282 "match_strategy": "fieldMatchSuffix", 2283 "always_true": false, 2284 "default_match_strategy": "fieldMatchUnknown", 2285 "reserved_match_strategy": "fieldMatchReserved", 2286 "default_data_type": "dataTypeUnknown", 2287 "expr_data_type": "dataTypeStr", 2288 "input_data_type": "dataTypeStr", 2289 "values": []string{`foobar`}, 2290 }, 2291 }, {name: "regex match an input string against a list of strings in addr field", 2292 condition: `regex match addr barfoo foobar`, 2293 want: map[string]interface{}{ 2294 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 2295 "field_name": "addr", 2296 "regex_enabled": true, 2297 "match_strategy": "fieldMatchRegex", 2298 "always_true": false, 2299 "default_match_strategy": "fieldMatchUnknown", 2300 "reserved_match_strategy": "fieldMatchReserved", 2301 "default_data_type": "dataTypeUnknown", 2302 "expr_data_type": "dataTypeListStr", 2303 "input_data_type": "dataTypeStr", 2304 "values": []string{`barfoo`, `foobar`}, 2305 }, 2306 }, { 2307 name: "failed regex match an input string against a list of strings in addr field", 2308 condition: `regex match addr barfoo (foobar|raboff`, 2309 shouldErr: true, 2310 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 2311 }, {name: "regex match an input string against a string condition in addr field", 2312 condition: `regex match addr foobar`, 2313 want: map[string]interface{}{ 2314 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 2315 "field_name": "addr", 2316 "regex_enabled": true, 2317 "match_strategy": "fieldMatchRegex", 2318 "always_true": false, 2319 "default_match_strategy": "fieldMatchUnknown", 2320 "reserved_match_strategy": "fieldMatchReserved", 2321 "default_data_type": "dataTypeUnknown", 2322 "expr_data_type": "dataTypeStr", 2323 "input_data_type": "dataTypeStr", 2324 "values": []string{`foobar`}, 2325 }, 2326 }, { 2327 name: "failed regex match an input string against a string condition in addr field", 2328 condition: `regex match addr foobar|raboff)`, 2329 shouldErr: true, 2330 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 2331 }, {name: "exact match an input string against a list of strings in method field", 2332 condition: `exact match method barfoo foobar`, 2333 want: map[string]interface{}{ 2334 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2335 "field_name": "method", 2336 "regex_enabled": false, 2337 "match_strategy": "fieldMatchExact", 2338 "always_true": false, 2339 "default_match_strategy": "fieldMatchUnknown", 2340 "reserved_match_strategy": "fieldMatchReserved", 2341 "default_data_type": "dataTypeUnknown", 2342 "expr_data_type": "dataTypeListStr", 2343 "input_data_type": "dataTypeStr", 2344 "values": []string{`barfoo`, `foobar`}, 2345 }, 2346 }, {name: "default match an input string against a list of strings in method field", 2347 condition: ` match method barfoo foobar`, 2348 want: map[string]interface{}{ 2349 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2350 "field_name": "method", 2351 "regex_enabled": false, 2352 "match_strategy": "fieldMatchExact", 2353 "always_true": false, 2354 "default_match_strategy": "fieldMatchUnknown", 2355 "reserved_match_strategy": "fieldMatchReserved", 2356 "default_data_type": "dataTypeUnknown", 2357 "expr_data_type": "dataTypeListStr", 2358 "input_data_type": "dataTypeStr", 2359 "values": []string{`barfoo`, `foobar`}, 2360 }, 2361 }, {name: "exact match an input string against a string condition in method field", 2362 condition: `exact match method foobar`, 2363 want: map[string]interface{}{ 2364 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2365 "field_name": "method", 2366 "regex_enabled": false, 2367 "match_strategy": "fieldMatchExact", 2368 "always_true": false, 2369 "default_match_strategy": "fieldMatchUnknown", 2370 "reserved_match_strategy": "fieldMatchReserved", 2371 "default_data_type": "dataTypeUnknown", 2372 "expr_data_type": "dataTypeStr", 2373 "input_data_type": "dataTypeStr", 2374 "values": []string{`foobar`}, 2375 }, 2376 }, {name: "default match an input string against a string condition in method field", 2377 condition: ` match method foobar`, 2378 want: map[string]interface{}{ 2379 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2380 "field_name": "method", 2381 "regex_enabled": false, 2382 "match_strategy": "fieldMatchExact", 2383 "always_true": false, 2384 "default_match_strategy": "fieldMatchUnknown", 2385 "reserved_match_strategy": "fieldMatchReserved", 2386 "default_data_type": "dataTypeUnknown", 2387 "expr_data_type": "dataTypeStr", 2388 "input_data_type": "dataTypeStr", 2389 "values": []string{`foobar`}, 2390 }, 2391 }, {name: "partial match an input string against a list of strings in method field", 2392 condition: `partial match method barfoo foobar`, 2393 want: map[string]interface{}{ 2394 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 2395 "field_name": "method", 2396 "regex_enabled": false, 2397 "match_strategy": "fieldMatchPartial", 2398 "always_true": false, 2399 "default_match_strategy": "fieldMatchUnknown", 2400 "reserved_match_strategy": "fieldMatchReserved", 2401 "default_data_type": "dataTypeUnknown", 2402 "expr_data_type": "dataTypeListStr", 2403 "input_data_type": "dataTypeStr", 2404 "values": []string{`barfoo`, `foobar`}, 2405 }, 2406 }, {name: "partial match an input string against a string condition in method field", 2407 condition: `partial match method foobar`, 2408 want: map[string]interface{}{ 2409 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 2410 "field_name": "method", 2411 "regex_enabled": false, 2412 "match_strategy": "fieldMatchPartial", 2413 "always_true": false, 2414 "default_match_strategy": "fieldMatchUnknown", 2415 "reserved_match_strategy": "fieldMatchReserved", 2416 "default_data_type": "dataTypeUnknown", 2417 "expr_data_type": "dataTypeStr", 2418 "input_data_type": "dataTypeStr", 2419 "values": []string{`foobar`}, 2420 }, 2421 }, {name: "prefix match an input string against a list of strings in method field", 2422 condition: `prefix match method barfoo foobar`, 2423 want: map[string]interface{}{ 2424 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 2425 "field_name": "method", 2426 "regex_enabled": false, 2427 "match_strategy": "fieldMatchPrefix", 2428 "always_true": false, 2429 "default_match_strategy": "fieldMatchUnknown", 2430 "reserved_match_strategy": "fieldMatchReserved", 2431 "default_data_type": "dataTypeUnknown", 2432 "expr_data_type": "dataTypeListStr", 2433 "input_data_type": "dataTypeStr", 2434 "values": []string{`barfoo`, `foobar`}, 2435 }, 2436 }, {name: "prefix match an input string against a string condition in method field", 2437 condition: `prefix match method foobar`, 2438 want: map[string]interface{}{ 2439 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 2440 "field_name": "method", 2441 "regex_enabled": false, 2442 "match_strategy": "fieldMatchPrefix", 2443 "always_true": false, 2444 "default_match_strategy": "fieldMatchUnknown", 2445 "reserved_match_strategy": "fieldMatchReserved", 2446 "default_data_type": "dataTypeUnknown", 2447 "expr_data_type": "dataTypeStr", 2448 "input_data_type": "dataTypeStr", 2449 "values": []string{`foobar`}, 2450 }, 2451 }, {name: "suffix match an input string against a list of strings in method field", 2452 condition: `suffix match method barfoo foobar`, 2453 want: map[string]interface{}{ 2454 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 2455 "field_name": "method", 2456 "regex_enabled": false, 2457 "match_strategy": "fieldMatchSuffix", 2458 "always_true": false, 2459 "default_match_strategy": "fieldMatchUnknown", 2460 "reserved_match_strategy": "fieldMatchReserved", 2461 "default_data_type": "dataTypeUnknown", 2462 "expr_data_type": "dataTypeListStr", 2463 "input_data_type": "dataTypeStr", 2464 "values": []string{`barfoo`, `foobar`}, 2465 }, 2466 }, {name: "suffix match an input string against a string condition in method field", 2467 condition: `suffix match method foobar`, 2468 want: map[string]interface{}{ 2469 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 2470 "field_name": "method", 2471 "regex_enabled": false, 2472 "match_strategy": "fieldMatchSuffix", 2473 "always_true": false, 2474 "default_match_strategy": "fieldMatchUnknown", 2475 "reserved_match_strategy": "fieldMatchReserved", 2476 "default_data_type": "dataTypeUnknown", 2477 "expr_data_type": "dataTypeStr", 2478 "input_data_type": "dataTypeStr", 2479 "values": []string{`foobar`}, 2480 }, 2481 }, {name: "regex match an input string against a list of strings in method field", 2482 condition: `regex match method barfoo foobar`, 2483 want: map[string]interface{}{ 2484 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 2485 "field_name": "method", 2486 "regex_enabled": true, 2487 "match_strategy": "fieldMatchRegex", 2488 "always_true": false, 2489 "default_match_strategy": "fieldMatchUnknown", 2490 "reserved_match_strategy": "fieldMatchReserved", 2491 "default_data_type": "dataTypeUnknown", 2492 "expr_data_type": "dataTypeListStr", 2493 "input_data_type": "dataTypeStr", 2494 "values": []string{`barfoo`, `foobar`}, 2495 }, 2496 }, { 2497 name: "failed regex match an input string against a list of strings in method field", 2498 condition: `regex match method barfoo (foobar|raboff`, 2499 shouldErr: true, 2500 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 2501 }, {name: "regex match an input string against a string condition in method field", 2502 condition: `regex match method foobar`, 2503 want: map[string]interface{}{ 2504 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 2505 "field_name": "method", 2506 "regex_enabled": true, 2507 "match_strategy": "fieldMatchRegex", 2508 "always_true": false, 2509 "default_match_strategy": "fieldMatchUnknown", 2510 "reserved_match_strategy": "fieldMatchReserved", 2511 "default_data_type": "dataTypeUnknown", 2512 "expr_data_type": "dataTypeStr", 2513 "input_data_type": "dataTypeStr", 2514 "values": []string{`foobar`}, 2515 }, 2516 }, { 2517 name: "failed regex match an input string against a string condition in method field", 2518 condition: `regex match method foobar|raboff)`, 2519 shouldErr: true, 2520 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 2521 }, {name: "exact match an input string against a list of strings in path field", 2522 condition: `exact match path barfoo foobar`, 2523 want: map[string]interface{}{ 2524 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2525 "field_name": "path", 2526 "regex_enabled": false, 2527 "match_strategy": "fieldMatchExact", 2528 "always_true": false, 2529 "default_match_strategy": "fieldMatchUnknown", 2530 "reserved_match_strategy": "fieldMatchReserved", 2531 "default_data_type": "dataTypeUnknown", 2532 "expr_data_type": "dataTypeListStr", 2533 "input_data_type": "dataTypeStr", 2534 "values": []string{`barfoo`, `foobar`}, 2535 }, 2536 }, {name: "default match an input string against a list of strings in path field", 2537 condition: ` match path barfoo foobar`, 2538 want: map[string]interface{}{ 2539 "condition_type": "*acl.ruleListStrCondExactMatchStrInput", 2540 "field_name": "path", 2541 "regex_enabled": false, 2542 "match_strategy": "fieldMatchExact", 2543 "always_true": false, 2544 "default_match_strategy": "fieldMatchUnknown", 2545 "reserved_match_strategy": "fieldMatchReserved", 2546 "default_data_type": "dataTypeUnknown", 2547 "expr_data_type": "dataTypeListStr", 2548 "input_data_type": "dataTypeStr", 2549 "values": []string{`barfoo`, `foobar`}, 2550 }, 2551 }, {name: "exact match an input string against a string condition in path field", 2552 condition: `exact match path foobar`, 2553 want: map[string]interface{}{ 2554 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2555 "field_name": "path", 2556 "regex_enabled": false, 2557 "match_strategy": "fieldMatchExact", 2558 "always_true": false, 2559 "default_match_strategy": "fieldMatchUnknown", 2560 "reserved_match_strategy": "fieldMatchReserved", 2561 "default_data_type": "dataTypeUnknown", 2562 "expr_data_type": "dataTypeStr", 2563 "input_data_type": "dataTypeStr", 2564 "values": []string{`foobar`}, 2565 }, 2566 }, {name: "default match an input string against a string condition in path field", 2567 condition: ` match path foobar`, 2568 want: map[string]interface{}{ 2569 "condition_type": "*acl.ruleStrCondExactMatchStrInput", 2570 "field_name": "path", 2571 "regex_enabled": false, 2572 "match_strategy": "fieldMatchExact", 2573 "always_true": false, 2574 "default_match_strategy": "fieldMatchUnknown", 2575 "reserved_match_strategy": "fieldMatchReserved", 2576 "default_data_type": "dataTypeUnknown", 2577 "expr_data_type": "dataTypeStr", 2578 "input_data_type": "dataTypeStr", 2579 "values": []string{`foobar`}, 2580 }, 2581 }, {name: "partial match an input string against a list of strings in path field", 2582 condition: `partial match path barfoo foobar`, 2583 want: map[string]interface{}{ 2584 "condition_type": "*acl.ruleListStrCondPartialMatchStrInput", 2585 "field_name": "path", 2586 "regex_enabled": false, 2587 "match_strategy": "fieldMatchPartial", 2588 "always_true": false, 2589 "default_match_strategy": "fieldMatchUnknown", 2590 "reserved_match_strategy": "fieldMatchReserved", 2591 "default_data_type": "dataTypeUnknown", 2592 "expr_data_type": "dataTypeListStr", 2593 "input_data_type": "dataTypeStr", 2594 "values": []string{`barfoo`, `foobar`}, 2595 }, 2596 }, {name: "partial match an input string against a string condition in path field", 2597 condition: `partial match path foobar`, 2598 want: map[string]interface{}{ 2599 "condition_type": "*acl.ruleStrCondPartialMatchStrInput", 2600 "field_name": "path", 2601 "regex_enabled": false, 2602 "match_strategy": "fieldMatchPartial", 2603 "always_true": false, 2604 "default_match_strategy": "fieldMatchUnknown", 2605 "reserved_match_strategy": "fieldMatchReserved", 2606 "default_data_type": "dataTypeUnknown", 2607 "expr_data_type": "dataTypeStr", 2608 "input_data_type": "dataTypeStr", 2609 "values": []string{`foobar`}, 2610 }, 2611 }, {name: "prefix match an input string against a list of strings in path field", 2612 condition: `prefix match path barfoo foobar`, 2613 want: map[string]interface{}{ 2614 "condition_type": "*acl.ruleListStrCondPrefixMatchStrInput", 2615 "field_name": "path", 2616 "regex_enabled": false, 2617 "match_strategy": "fieldMatchPrefix", 2618 "always_true": false, 2619 "default_match_strategy": "fieldMatchUnknown", 2620 "reserved_match_strategy": "fieldMatchReserved", 2621 "default_data_type": "dataTypeUnknown", 2622 "expr_data_type": "dataTypeListStr", 2623 "input_data_type": "dataTypeStr", 2624 "values": []string{`barfoo`, `foobar`}, 2625 }, 2626 }, {name: "prefix match an input string against a string condition in path field", 2627 condition: `prefix match path foobar`, 2628 want: map[string]interface{}{ 2629 "condition_type": "*acl.ruleStrCondPrefixMatchStrInput", 2630 "field_name": "path", 2631 "regex_enabled": false, 2632 "match_strategy": "fieldMatchPrefix", 2633 "always_true": false, 2634 "default_match_strategy": "fieldMatchUnknown", 2635 "reserved_match_strategy": "fieldMatchReserved", 2636 "default_data_type": "dataTypeUnknown", 2637 "expr_data_type": "dataTypeStr", 2638 "input_data_type": "dataTypeStr", 2639 "values": []string{`foobar`}, 2640 }, 2641 }, {name: "suffix match an input string against a list of strings in path field", 2642 condition: `suffix match path barfoo foobar`, 2643 want: map[string]interface{}{ 2644 "condition_type": "*acl.ruleListStrCondSuffixMatchStrInput", 2645 "field_name": "path", 2646 "regex_enabled": false, 2647 "match_strategy": "fieldMatchSuffix", 2648 "always_true": false, 2649 "default_match_strategy": "fieldMatchUnknown", 2650 "reserved_match_strategy": "fieldMatchReserved", 2651 "default_data_type": "dataTypeUnknown", 2652 "expr_data_type": "dataTypeListStr", 2653 "input_data_type": "dataTypeStr", 2654 "values": []string{`barfoo`, `foobar`}, 2655 }, 2656 }, {name: "suffix match an input string against a string condition in path field", 2657 condition: `suffix match path foobar`, 2658 want: map[string]interface{}{ 2659 "condition_type": "*acl.ruleStrCondSuffixMatchStrInput", 2660 "field_name": "path", 2661 "regex_enabled": false, 2662 "match_strategy": "fieldMatchSuffix", 2663 "always_true": false, 2664 "default_match_strategy": "fieldMatchUnknown", 2665 "reserved_match_strategy": "fieldMatchReserved", 2666 "default_data_type": "dataTypeUnknown", 2667 "expr_data_type": "dataTypeStr", 2668 "input_data_type": "dataTypeStr", 2669 "values": []string{`foobar`}, 2670 }, 2671 }, {name: "regex match an input string against a list of strings in path field", 2672 condition: `regex match path barfoo foobar`, 2673 want: map[string]interface{}{ 2674 "condition_type": "*acl.ruleListStrCondRegexMatchStrInput", 2675 "field_name": "path", 2676 "regex_enabled": true, 2677 "match_strategy": "fieldMatchRegex", 2678 "always_true": false, 2679 "default_match_strategy": "fieldMatchUnknown", 2680 "reserved_match_strategy": "fieldMatchReserved", 2681 "default_data_type": "dataTypeUnknown", 2682 "expr_data_type": "dataTypeListStr", 2683 "input_data_type": "dataTypeStr", 2684 "values": []string{`barfoo`, `foobar`}, 2685 }, 2686 }, { 2687 name: "failed regex match an input string against a list of strings in path field", 2688 condition: `regex match path barfoo (foobar|raboff`, 2689 shouldErr: true, 2690 err: fmt.Errorf("error parsing regexp: missing closing ): `(foobar|raboff`"), 2691 }, {name: "regex match an input string against a string condition in path field", 2692 condition: `regex match path foobar`, 2693 want: map[string]interface{}{ 2694 "condition_type": "*acl.ruleStrCondRegexMatchStrInput", 2695 "field_name": "path", 2696 "regex_enabled": true, 2697 "match_strategy": "fieldMatchRegex", 2698 "always_true": false, 2699 "default_match_strategy": "fieldMatchUnknown", 2700 "reserved_match_strategy": "fieldMatchReserved", 2701 "default_data_type": "dataTypeUnknown", 2702 "expr_data_type": "dataTypeStr", 2703 "input_data_type": "dataTypeStr", 2704 "values": []string{`foobar`}, 2705 }, 2706 }, { 2707 name: "failed regex match an input string against a string condition in path field", 2708 condition: `regex match path foobar|raboff)`, 2709 shouldErr: true, 2710 err: fmt.Errorf("error parsing regexp: unexpected ): `foobar|raboff)`"), 2711 }, { 2712 name: "invalid condition syntax match not found", 2713 condition: `exact`, 2714 shouldErr: true, 2715 err: errors.ErrACLRuleConditionSyntaxMatchNotFound.WithArgs("exact"), 2716 }, { 2717 name: "invalid condition syntax field name not found", 2718 condition: `exact match`, 2719 shouldErr: true, 2720 err: errors.ErrACLRuleConditionSyntaxMatchFieldNotFound.WithArgs("exact match"), 2721 }, { 2722 name: "invalid condition syntax not matching field values", 2723 condition: `exact match roles`, 2724 shouldErr: true, 2725 err: errors.ErrACLRuleConditionSyntaxMatchValueNotFound.WithArgs("exact match roles"), 2726 }, { 2727 name: "invalid condition syntax use of reserved keyword", 2728 condition: `exact match roles partial`, 2729 shouldErr: true, 2730 err: errors.ErrACLRuleConditionSyntaxReservedWordUsage.WithArgs("partial", "exact match roles partial"), 2731 }, { 2732 name: "invalid condition syntax unsupported field", 2733 condition: `exact match bootstrap yes`, 2734 shouldErr: true, 2735 err: errors.ErrACLRuleConditionSyntaxUnsupported.WithArgs("exact match bootstrap yes"), 2736 }, { 2737 name: "invalid condition syntax use of reserved type", 2738 condition: `reserved match roles anonymous`, 2739 shouldErr: true, 2740 err: errors.ErrACLRuleConditionSyntaxMatchNotFound.WithArgs("reserved match roles anonymous"), 2741 }, 2742 } 2743 for _, tc := range testcases { 2744 t.Run(tc.name, func(t *testing.T) { 2745 // t.Logf(tc.name) 2746 // t.Logf(tc.condition) 2747 ctx := context.Background() 2748 var cond aclRuleCondition 2749 parsedACLRuleCondition, err := newACLRuleCondition(ctx, strings.Split(tc.condition, " ")) 2750 if tests.EvalErr(t, err, tc.condition, tc.shouldErr, tc.err) { 2751 return 2752 } 2753 cond = parsedACLRuleCondition 2754 condConfig := cond.getConfig(context.Background()) 2755 got := make(map[string]interface{}) 2756 got["field_name"] = condConfig.field 2757 got["condition_type"] = reflect.TypeOf(cond).String() 2758 got["match_strategy"] = getMatchStrategyName(condConfig.matchStrategy) 2759 got["default_match_strategy"] = getMatchStrategyName(fieldMatchUnknown) 2760 got["reserved_match_strategy"] = getMatchStrategyName(fieldMatchReserved) 2761 got["regex_enabled"] = condConfig.regexEnabled 2762 got["always_true"] = condConfig.alwaysTrue 2763 got["expr_data_type"] = getDataTypeName(condConfig.exprDataType) 2764 got["input_data_type"] = getDataTypeName(condConfig.inputDataType) 2765 got["default_data_type"] = getDataTypeName(dataTypeUnknown) 2766 got["values"] = condConfig.values 2767 tests.EvalObjects(t, "output", tc.want, got) 2768 }) 2769 } 2770 } 2771 2772 func TestMatchAclRuleCondition(t *testing.T) { 2773 var testcases = []struct { 2774 name string 2775 condition string 2776 values map[string]interface{} 2777 want map[string]interface{} 2778 shouldErr bool 2779 err error 2780 }{ 2781 2782 {name: "failed exact match a list of strings input against a list of strings in roles field", 2783 condition: `exact match roles barfoo foobar`, 2784 values: map[string]interface{}{ 2785 "data": []string{"oograb", "foobar"}, 2786 }, 2787 want: map[string]interface{}{ 2788 "match": true, 2789 }, 2790 }, {name: "exact match a list of strings input against a list of strings in roles field", 2791 condition: `exact match roles barfoo foobar`, 2792 values: map[string]interface{}{ 2793 "data": []string{"billy", "bones"}, 2794 }, 2795 want: map[string]interface{}{ 2796 "match": false, 2797 }, 2798 }, {name: "failed default match a list of strings input against a list of strings in roles field", 2799 condition: ` match roles barfoo foobar`, 2800 values: map[string]interface{}{ 2801 "data": []string{"oograb", "foobar"}, 2802 }, 2803 want: map[string]interface{}{ 2804 "match": true, 2805 }, 2806 }, {name: "default match a list of strings input against a list of strings in roles field", 2807 condition: ` match roles barfoo foobar`, 2808 values: map[string]interface{}{ 2809 "data": []string{"billy", "bones"}, 2810 }, 2811 want: map[string]interface{}{ 2812 "match": false, 2813 }, 2814 }, {name: "failed exact match a list of strings input against a string condition in roles field", 2815 condition: `exact match roles foobar`, 2816 values: map[string]interface{}{ 2817 "data": []string{"oograb", "foobar"}, 2818 }, 2819 want: map[string]interface{}{ 2820 "match": true, 2821 }, 2822 }, {name: "exact match a list of strings input against a string condition in roles field", 2823 condition: `exact match roles foobar`, 2824 values: map[string]interface{}{ 2825 "data": []string{"billy", "bones"}, 2826 }, 2827 want: map[string]interface{}{ 2828 "match": false, 2829 }, 2830 }, {name: "failed default match a list of strings input against a string condition in roles field", 2831 condition: ` match roles foobar`, 2832 values: map[string]interface{}{ 2833 "data": []string{"oograb", "foobar"}, 2834 }, 2835 want: map[string]interface{}{ 2836 "match": true, 2837 }, 2838 }, {name: "default match a list of strings input against a string condition in roles field", 2839 condition: ` match roles foobar`, 2840 values: map[string]interface{}{ 2841 "data": []string{"billy", "bones"}, 2842 }, 2843 want: map[string]interface{}{ 2844 "match": false, 2845 }, 2846 }, {name: "failed partial match a list of strings input against a list of strings in roles field", 2847 condition: `partial match roles barfoo foobar`, 2848 values: map[string]interface{}{ 2849 "data": []string{"oograb", "foobar"}, 2850 }, 2851 want: map[string]interface{}{ 2852 "match": true, 2853 }, 2854 }, {name: "partial match a list of strings input against a list of strings in roles field", 2855 condition: `partial match roles barfoo foobar`, 2856 values: map[string]interface{}{ 2857 "data": []string{"billy", "bones"}, 2858 }, 2859 want: map[string]interface{}{ 2860 "match": false, 2861 }, 2862 }, {name: "failed partial match a list of strings input against a string condition in roles field", 2863 condition: `partial match roles foobar`, 2864 values: map[string]interface{}{ 2865 "data": []string{"oograb", "foobar"}, 2866 }, 2867 want: map[string]interface{}{ 2868 "match": true, 2869 }, 2870 }, {name: "partial match a list of strings input against a string condition in roles field", 2871 condition: `partial match roles foobar`, 2872 values: map[string]interface{}{ 2873 "data": []string{"billy", "bones"}, 2874 }, 2875 want: map[string]interface{}{ 2876 "match": false, 2877 }, 2878 }, {name: "failed prefix match a list of strings input against a list of strings in roles field", 2879 condition: `prefix match roles barfoo foobar`, 2880 values: map[string]interface{}{ 2881 "data": []string{"oograb", "foobar"}, 2882 }, 2883 want: map[string]interface{}{ 2884 "match": true, 2885 }, 2886 }, {name: "prefix match a list of strings input against a list of strings in roles field", 2887 condition: `prefix match roles barfoo foobar`, 2888 values: map[string]interface{}{ 2889 "data": []string{"billy", "bones"}, 2890 }, 2891 want: map[string]interface{}{ 2892 "match": false, 2893 }, 2894 }, {name: "failed prefix match a list of strings input against a string condition in roles field", 2895 condition: `prefix match roles foobar`, 2896 values: map[string]interface{}{ 2897 "data": []string{"oograb", "foobar"}, 2898 }, 2899 want: map[string]interface{}{ 2900 "match": true, 2901 }, 2902 }, {name: "prefix match a list of strings input against a string condition in roles field", 2903 condition: `prefix match roles foobar`, 2904 values: map[string]interface{}{ 2905 "data": []string{"billy", "bones"}, 2906 }, 2907 want: map[string]interface{}{ 2908 "match": false, 2909 }, 2910 }, {name: "failed suffix match a list of strings input against a list of strings in roles field", 2911 condition: `suffix match roles barfoo foobar`, 2912 values: map[string]interface{}{ 2913 "data": []string{"oograb", "foobar"}, 2914 }, 2915 want: map[string]interface{}{ 2916 "match": true, 2917 }, 2918 }, {name: "suffix match a list of strings input against a list of strings in roles field", 2919 condition: `suffix match roles barfoo foobar`, 2920 values: map[string]interface{}{ 2921 "data": []string{"billy", "bones"}, 2922 }, 2923 want: map[string]interface{}{ 2924 "match": false, 2925 }, 2926 }, {name: "failed suffix match a list of strings input against a string condition in roles field", 2927 condition: `suffix match roles foobar`, 2928 values: map[string]interface{}{ 2929 "data": []string{"oograb", "foobar"}, 2930 }, 2931 want: map[string]interface{}{ 2932 "match": true, 2933 }, 2934 }, {name: "suffix match a list of strings input against a string condition in roles field", 2935 condition: `suffix match roles foobar`, 2936 values: map[string]interface{}{ 2937 "data": []string{"billy", "bones"}, 2938 }, 2939 want: map[string]interface{}{ 2940 "match": false, 2941 }, 2942 }, {name: "failed regex match a list of strings input against a list of strings in roles field", 2943 condition: `regex match roles barfoo foobar`, 2944 values: map[string]interface{}{ 2945 "data": []string{"oograb", "foobar"}, 2946 }, 2947 want: map[string]interface{}{ 2948 "match": true, 2949 }, 2950 }, {name: "regex match a list of strings input against a list of strings in roles field", 2951 condition: `regex match roles barfoo foobar`, 2952 values: map[string]interface{}{ 2953 "data": []string{"billy", "bones"}, 2954 }, 2955 want: map[string]interface{}{ 2956 "match": false, 2957 }, 2958 }, {name: "failed regex match a list of strings input against a string condition in roles field", 2959 condition: `regex match roles foobar`, 2960 values: map[string]interface{}{ 2961 "data": []string{"oograb", "foobar"}, 2962 }, 2963 want: map[string]interface{}{ 2964 "match": true, 2965 }, 2966 }, {name: "regex match a list of strings input against a string condition in roles field", 2967 condition: `regex match roles foobar`, 2968 values: map[string]interface{}{ 2969 "data": []string{"billy", "bones"}, 2970 }, 2971 want: map[string]interface{}{ 2972 "match": false, 2973 }, 2974 }, {name: "failed exact match an input string against a list of strings in email field", 2975 condition: `exact match email barfoo foobar`, 2976 values: map[string]interface{}{ 2977 "data": "foobar", 2978 }, 2979 want: map[string]interface{}{ 2980 "match": true, 2981 }, 2982 }, {name: "exact match an input string against a list of strings in email field", 2983 condition: `exact match email barfoo foobar`, 2984 values: map[string]interface{}{ 2985 "data": "billy", 2986 }, 2987 want: map[string]interface{}{ 2988 "match": false, 2989 }, 2990 }, {name: "failed default match an input string against a list of strings in email field", 2991 condition: ` match email barfoo foobar`, 2992 values: map[string]interface{}{ 2993 "data": "foobar", 2994 }, 2995 want: map[string]interface{}{ 2996 "match": true, 2997 }, 2998 }, {name: "default match an input string against a list of strings in email field", 2999 condition: ` match email barfoo foobar`, 3000 values: map[string]interface{}{ 3001 "data": "billy", 3002 }, 3003 want: map[string]interface{}{ 3004 "match": false, 3005 }, 3006 }, {name: "failed exact match an input string against a string condition in email field", 3007 condition: `exact match email foobar`, 3008 values: map[string]interface{}{ 3009 "data": "foobar", 3010 }, 3011 want: map[string]interface{}{ 3012 "match": true, 3013 }, 3014 }, {name: "exact match an input string against a string condition in email field", 3015 condition: `exact match email foobar`, 3016 values: map[string]interface{}{ 3017 "data": "billy", 3018 }, 3019 want: map[string]interface{}{ 3020 "match": false, 3021 }, 3022 }, {name: "failed default match an input string against a string condition in email field", 3023 condition: ` match email foobar`, 3024 values: map[string]interface{}{ 3025 "data": "foobar", 3026 }, 3027 want: map[string]interface{}{ 3028 "match": true, 3029 }, 3030 }, {name: "default match an input string against a string condition in email field", 3031 condition: ` match email foobar`, 3032 values: map[string]interface{}{ 3033 "data": "billy", 3034 }, 3035 want: map[string]interface{}{ 3036 "match": false, 3037 }, 3038 }, {name: "failed partial match an input string against a list of strings in email field", 3039 condition: `partial match email barfoo foobar`, 3040 values: map[string]interface{}{ 3041 "data": "foobar", 3042 }, 3043 want: map[string]interface{}{ 3044 "match": true, 3045 }, 3046 }, {name: "partial match an input string against a list of strings in email field", 3047 condition: `partial match email barfoo foobar`, 3048 values: map[string]interface{}{ 3049 "data": "billy", 3050 }, 3051 want: map[string]interface{}{ 3052 "match": false, 3053 }, 3054 }, {name: "failed partial match an input string against a string condition in email field", 3055 condition: `partial match email foobar`, 3056 values: map[string]interface{}{ 3057 "data": "foobar", 3058 }, 3059 want: map[string]interface{}{ 3060 "match": true, 3061 }, 3062 }, {name: "partial match an input string against a string condition in email field", 3063 condition: `partial match email foobar`, 3064 values: map[string]interface{}{ 3065 "data": "billy", 3066 }, 3067 want: map[string]interface{}{ 3068 "match": false, 3069 }, 3070 }, {name: "failed prefix match an input string against a list of strings in email field", 3071 condition: `prefix match email barfoo foobar`, 3072 values: map[string]interface{}{ 3073 "data": "foobar", 3074 }, 3075 want: map[string]interface{}{ 3076 "match": true, 3077 }, 3078 }, {name: "prefix match an input string against a list of strings in email field", 3079 condition: `prefix match email barfoo foobar`, 3080 values: map[string]interface{}{ 3081 "data": "billy", 3082 }, 3083 want: map[string]interface{}{ 3084 "match": false, 3085 }, 3086 }, {name: "failed prefix match an input string against a string condition in email field", 3087 condition: `prefix match email foobar`, 3088 values: map[string]interface{}{ 3089 "data": "foobar", 3090 }, 3091 want: map[string]interface{}{ 3092 "match": true, 3093 }, 3094 }, {name: "prefix match an input string against a string condition in email field", 3095 condition: `prefix match email foobar`, 3096 values: map[string]interface{}{ 3097 "data": "billy", 3098 }, 3099 want: map[string]interface{}{ 3100 "match": false, 3101 }, 3102 }, {name: "failed suffix match an input string against a list of strings in email field", 3103 condition: `suffix match email barfoo foobar`, 3104 values: map[string]interface{}{ 3105 "data": "foobar", 3106 }, 3107 want: map[string]interface{}{ 3108 "match": true, 3109 }, 3110 }, {name: "suffix match an input string against a list of strings in email field", 3111 condition: `suffix match email barfoo foobar`, 3112 values: map[string]interface{}{ 3113 "data": "billy", 3114 }, 3115 want: map[string]interface{}{ 3116 "match": false, 3117 }, 3118 }, {name: "failed suffix match an input string against a string condition in email field", 3119 condition: `suffix match email foobar`, 3120 values: map[string]interface{}{ 3121 "data": "foobar", 3122 }, 3123 want: map[string]interface{}{ 3124 "match": true, 3125 }, 3126 }, {name: "suffix match an input string against a string condition in email field", 3127 condition: `suffix match email foobar`, 3128 values: map[string]interface{}{ 3129 "data": "billy", 3130 }, 3131 want: map[string]interface{}{ 3132 "match": false, 3133 }, 3134 }, {name: "failed regex match an input string against a list of strings in email field", 3135 condition: `regex match email barfoo foobar`, 3136 values: map[string]interface{}{ 3137 "data": "foobar", 3138 }, 3139 want: map[string]interface{}{ 3140 "match": true, 3141 }, 3142 }, {name: "regex match an input string against a list of strings in email field", 3143 condition: `regex match email barfoo foobar`, 3144 values: map[string]interface{}{ 3145 "data": "billy", 3146 }, 3147 want: map[string]interface{}{ 3148 "match": false, 3149 }, 3150 }, {name: "failed regex match an input string against a string condition in email field", 3151 condition: `regex match email foobar`, 3152 values: map[string]interface{}{ 3153 "data": "foobar", 3154 }, 3155 want: map[string]interface{}{ 3156 "match": true, 3157 }, 3158 }, {name: "regex match an input string against a string condition in email field", 3159 condition: `regex match email foobar`, 3160 values: map[string]interface{}{ 3161 "data": "billy", 3162 }, 3163 want: map[string]interface{}{ 3164 "match": false, 3165 }, 3166 }, {name: "failed exact match an input string against a list of strings in origin field", 3167 condition: `exact match origin barfoo foobar`, 3168 values: map[string]interface{}{ 3169 "data": "foobar", 3170 }, 3171 want: map[string]interface{}{ 3172 "match": true, 3173 }, 3174 }, {name: "exact match an input string against a list of strings in origin field", 3175 condition: `exact match origin barfoo foobar`, 3176 values: map[string]interface{}{ 3177 "data": "billy", 3178 }, 3179 want: map[string]interface{}{ 3180 "match": false, 3181 }, 3182 }, {name: "failed default match an input string against a list of strings in origin field", 3183 condition: ` match origin barfoo foobar`, 3184 values: map[string]interface{}{ 3185 "data": "foobar", 3186 }, 3187 want: map[string]interface{}{ 3188 "match": true, 3189 }, 3190 }, {name: "default match an input string against a list of strings in origin field", 3191 condition: ` match origin barfoo foobar`, 3192 values: map[string]interface{}{ 3193 "data": "billy", 3194 }, 3195 want: map[string]interface{}{ 3196 "match": false, 3197 }, 3198 }, {name: "failed exact match an input string against a string condition in origin field", 3199 condition: `exact match origin foobar`, 3200 values: map[string]interface{}{ 3201 "data": "foobar", 3202 }, 3203 want: map[string]interface{}{ 3204 "match": true, 3205 }, 3206 }, {name: "exact match an input string against a string condition in origin field", 3207 condition: `exact match origin foobar`, 3208 values: map[string]interface{}{ 3209 "data": "billy", 3210 }, 3211 want: map[string]interface{}{ 3212 "match": false, 3213 }, 3214 }, {name: "failed default match an input string against a string condition in origin field", 3215 condition: ` match origin foobar`, 3216 values: map[string]interface{}{ 3217 "data": "foobar", 3218 }, 3219 want: map[string]interface{}{ 3220 "match": true, 3221 }, 3222 }, {name: "default match an input string against a string condition in origin field", 3223 condition: ` match origin foobar`, 3224 values: map[string]interface{}{ 3225 "data": "billy", 3226 }, 3227 want: map[string]interface{}{ 3228 "match": false, 3229 }, 3230 }, {name: "failed partial match an input string against a list of strings in origin field", 3231 condition: `partial match origin barfoo foobar`, 3232 values: map[string]interface{}{ 3233 "data": "foobar", 3234 }, 3235 want: map[string]interface{}{ 3236 "match": true, 3237 }, 3238 }, {name: "partial match an input string against a list of strings in origin field", 3239 condition: `partial match origin barfoo foobar`, 3240 values: map[string]interface{}{ 3241 "data": "billy", 3242 }, 3243 want: map[string]interface{}{ 3244 "match": false, 3245 }, 3246 }, {name: "failed partial match an input string against a string condition in origin field", 3247 condition: `partial match origin foobar`, 3248 values: map[string]interface{}{ 3249 "data": "foobar", 3250 }, 3251 want: map[string]interface{}{ 3252 "match": true, 3253 }, 3254 }, {name: "partial match an input string against a string condition in origin field", 3255 condition: `partial match origin foobar`, 3256 values: map[string]interface{}{ 3257 "data": "billy", 3258 }, 3259 want: map[string]interface{}{ 3260 "match": false, 3261 }, 3262 }, {name: "failed prefix match an input string against a list of strings in origin field", 3263 condition: `prefix match origin barfoo foobar`, 3264 values: map[string]interface{}{ 3265 "data": "foobar", 3266 }, 3267 want: map[string]interface{}{ 3268 "match": true, 3269 }, 3270 }, {name: "prefix match an input string against a list of strings in origin field", 3271 condition: `prefix match origin barfoo foobar`, 3272 values: map[string]interface{}{ 3273 "data": "billy", 3274 }, 3275 want: map[string]interface{}{ 3276 "match": false, 3277 }, 3278 }, {name: "failed prefix match an input string against a string condition in origin field", 3279 condition: `prefix match origin foobar`, 3280 values: map[string]interface{}{ 3281 "data": "foobar", 3282 }, 3283 want: map[string]interface{}{ 3284 "match": true, 3285 }, 3286 }, {name: "prefix match an input string against a string condition in origin field", 3287 condition: `prefix match origin foobar`, 3288 values: map[string]interface{}{ 3289 "data": "billy", 3290 }, 3291 want: map[string]interface{}{ 3292 "match": false, 3293 }, 3294 }, {name: "failed suffix match an input string against a list of strings in origin field", 3295 condition: `suffix match origin barfoo foobar`, 3296 values: map[string]interface{}{ 3297 "data": "foobar", 3298 }, 3299 want: map[string]interface{}{ 3300 "match": true, 3301 }, 3302 }, {name: "suffix match an input string against a list of strings in origin field", 3303 condition: `suffix match origin barfoo foobar`, 3304 values: map[string]interface{}{ 3305 "data": "billy", 3306 }, 3307 want: map[string]interface{}{ 3308 "match": false, 3309 }, 3310 }, {name: "failed suffix match an input string against a string condition in origin field", 3311 condition: `suffix match origin foobar`, 3312 values: map[string]interface{}{ 3313 "data": "foobar", 3314 }, 3315 want: map[string]interface{}{ 3316 "match": true, 3317 }, 3318 }, {name: "suffix match an input string against a string condition in origin field", 3319 condition: `suffix match origin foobar`, 3320 values: map[string]interface{}{ 3321 "data": "billy", 3322 }, 3323 want: map[string]interface{}{ 3324 "match": false, 3325 }, 3326 }, {name: "failed regex match an input string against a list of strings in origin field", 3327 condition: `regex match origin barfoo foobar`, 3328 values: map[string]interface{}{ 3329 "data": "foobar", 3330 }, 3331 want: map[string]interface{}{ 3332 "match": true, 3333 }, 3334 }, {name: "regex match an input string against a list of strings in origin field", 3335 condition: `regex match origin barfoo foobar`, 3336 values: map[string]interface{}{ 3337 "data": "billy", 3338 }, 3339 want: map[string]interface{}{ 3340 "match": false, 3341 }, 3342 }, {name: "failed regex match an input string against a string condition in origin field", 3343 condition: `regex match origin foobar`, 3344 values: map[string]interface{}{ 3345 "data": "foobar", 3346 }, 3347 want: map[string]interface{}{ 3348 "match": true, 3349 }, 3350 }, {name: "regex match an input string against a string condition in origin field", 3351 condition: `regex match origin foobar`, 3352 values: map[string]interface{}{ 3353 "data": "billy", 3354 }, 3355 want: map[string]interface{}{ 3356 "match": false, 3357 }, 3358 }, {name: "failed exact match an input string against a list of strings in name field", 3359 condition: `exact match name barfoo foobar`, 3360 values: map[string]interface{}{ 3361 "data": "foobar", 3362 }, 3363 want: map[string]interface{}{ 3364 "match": true, 3365 }, 3366 }, {name: "exact match an input string against a list of strings in name field", 3367 condition: `exact match name barfoo foobar`, 3368 values: map[string]interface{}{ 3369 "data": "billy", 3370 }, 3371 want: map[string]interface{}{ 3372 "match": false, 3373 }, 3374 }, {name: "failed default match an input string against a list of strings in name field", 3375 condition: ` match name barfoo foobar`, 3376 values: map[string]interface{}{ 3377 "data": "foobar", 3378 }, 3379 want: map[string]interface{}{ 3380 "match": true, 3381 }, 3382 }, {name: "default match an input string against a list of strings in name field", 3383 condition: ` match name barfoo foobar`, 3384 values: map[string]interface{}{ 3385 "data": "billy", 3386 }, 3387 want: map[string]interface{}{ 3388 "match": false, 3389 }, 3390 }, {name: "failed exact match an input string against a string condition in name field", 3391 condition: `exact match name foobar`, 3392 values: map[string]interface{}{ 3393 "data": "foobar", 3394 }, 3395 want: map[string]interface{}{ 3396 "match": true, 3397 }, 3398 }, {name: "exact match an input string against a string condition in name field", 3399 condition: `exact match name foobar`, 3400 values: map[string]interface{}{ 3401 "data": "billy", 3402 }, 3403 want: map[string]interface{}{ 3404 "match": false, 3405 }, 3406 }, {name: "failed default match an input string against a string condition in name field", 3407 condition: ` match name foobar`, 3408 values: map[string]interface{}{ 3409 "data": "foobar", 3410 }, 3411 want: map[string]interface{}{ 3412 "match": true, 3413 }, 3414 }, {name: "default match an input string against a string condition in name field", 3415 condition: ` match name foobar`, 3416 values: map[string]interface{}{ 3417 "data": "billy", 3418 }, 3419 want: map[string]interface{}{ 3420 "match": false, 3421 }, 3422 }, {name: "failed partial match an input string against a list of strings in name field", 3423 condition: `partial match name barfoo foobar`, 3424 values: map[string]interface{}{ 3425 "data": "foobar", 3426 }, 3427 want: map[string]interface{}{ 3428 "match": true, 3429 }, 3430 }, {name: "partial match an input string against a list of strings in name field", 3431 condition: `partial match name barfoo foobar`, 3432 values: map[string]interface{}{ 3433 "data": "billy", 3434 }, 3435 want: map[string]interface{}{ 3436 "match": false, 3437 }, 3438 }, {name: "failed partial match an input string against a string condition in name field", 3439 condition: `partial match name foobar`, 3440 values: map[string]interface{}{ 3441 "data": "foobar", 3442 }, 3443 want: map[string]interface{}{ 3444 "match": true, 3445 }, 3446 }, {name: "partial match an input string against a string condition in name field", 3447 condition: `partial match name foobar`, 3448 values: map[string]interface{}{ 3449 "data": "billy", 3450 }, 3451 want: map[string]interface{}{ 3452 "match": false, 3453 }, 3454 }, {name: "failed prefix match an input string against a list of strings in name field", 3455 condition: `prefix match name barfoo foobar`, 3456 values: map[string]interface{}{ 3457 "data": "foobar", 3458 }, 3459 want: map[string]interface{}{ 3460 "match": true, 3461 }, 3462 }, {name: "prefix match an input string against a list of strings in name field", 3463 condition: `prefix match name barfoo foobar`, 3464 values: map[string]interface{}{ 3465 "data": "billy", 3466 }, 3467 want: map[string]interface{}{ 3468 "match": false, 3469 }, 3470 }, {name: "failed prefix match an input string against a string condition in name field", 3471 condition: `prefix match name foobar`, 3472 values: map[string]interface{}{ 3473 "data": "foobar", 3474 }, 3475 want: map[string]interface{}{ 3476 "match": true, 3477 }, 3478 }, {name: "prefix match an input string against a string condition in name field", 3479 condition: `prefix match name foobar`, 3480 values: map[string]interface{}{ 3481 "data": "billy", 3482 }, 3483 want: map[string]interface{}{ 3484 "match": false, 3485 }, 3486 }, {name: "failed suffix match an input string against a list of strings in name field", 3487 condition: `suffix match name barfoo foobar`, 3488 values: map[string]interface{}{ 3489 "data": "foobar", 3490 }, 3491 want: map[string]interface{}{ 3492 "match": true, 3493 }, 3494 }, {name: "suffix match an input string against a list of strings in name field", 3495 condition: `suffix match name barfoo foobar`, 3496 values: map[string]interface{}{ 3497 "data": "billy", 3498 }, 3499 want: map[string]interface{}{ 3500 "match": false, 3501 }, 3502 }, {name: "failed suffix match an input string against a string condition in name field", 3503 condition: `suffix match name foobar`, 3504 values: map[string]interface{}{ 3505 "data": "foobar", 3506 }, 3507 want: map[string]interface{}{ 3508 "match": true, 3509 }, 3510 }, {name: "suffix match an input string against a string condition in name field", 3511 condition: `suffix match name foobar`, 3512 values: map[string]interface{}{ 3513 "data": "billy", 3514 }, 3515 want: map[string]interface{}{ 3516 "match": false, 3517 }, 3518 }, {name: "failed regex match an input string against a list of strings in name field", 3519 condition: `regex match name barfoo foobar`, 3520 values: map[string]interface{}{ 3521 "data": "foobar", 3522 }, 3523 want: map[string]interface{}{ 3524 "match": true, 3525 }, 3526 }, {name: "regex match an input string against a list of strings in name field", 3527 condition: `regex match name barfoo foobar`, 3528 values: map[string]interface{}{ 3529 "data": "billy", 3530 }, 3531 want: map[string]interface{}{ 3532 "match": false, 3533 }, 3534 }, {name: "failed regex match an input string against a string condition in name field", 3535 condition: `regex match name foobar`, 3536 values: map[string]interface{}{ 3537 "data": "foobar", 3538 }, 3539 want: map[string]interface{}{ 3540 "match": true, 3541 }, 3542 }, {name: "regex match an input string against a string condition in name field", 3543 condition: `regex match name foobar`, 3544 values: map[string]interface{}{ 3545 "data": "billy", 3546 }, 3547 want: map[string]interface{}{ 3548 "match": false, 3549 }, 3550 }, {name: "failed exact match an input string against a list of strings in realm field", 3551 condition: `exact match realm barfoo foobar`, 3552 values: map[string]interface{}{ 3553 "data": "foobar", 3554 }, 3555 want: map[string]interface{}{ 3556 "match": true, 3557 }, 3558 }, {name: "exact match an input string against a list of strings in realm field", 3559 condition: `exact match realm barfoo foobar`, 3560 values: map[string]interface{}{ 3561 "data": "billy", 3562 }, 3563 want: map[string]interface{}{ 3564 "match": false, 3565 }, 3566 }, {name: "failed default match an input string against a list of strings in realm field", 3567 condition: ` match realm barfoo foobar`, 3568 values: map[string]interface{}{ 3569 "data": "foobar", 3570 }, 3571 want: map[string]interface{}{ 3572 "match": true, 3573 }, 3574 }, {name: "default match an input string against a list of strings in realm field", 3575 condition: ` match realm barfoo foobar`, 3576 values: map[string]interface{}{ 3577 "data": "billy", 3578 }, 3579 want: map[string]interface{}{ 3580 "match": false, 3581 }, 3582 }, {name: "failed exact match an input string against a string condition in realm field", 3583 condition: `exact match realm foobar`, 3584 values: map[string]interface{}{ 3585 "data": "foobar", 3586 }, 3587 want: map[string]interface{}{ 3588 "match": true, 3589 }, 3590 }, {name: "exact match an input string against a string condition in realm field", 3591 condition: `exact match realm foobar`, 3592 values: map[string]interface{}{ 3593 "data": "billy", 3594 }, 3595 want: map[string]interface{}{ 3596 "match": false, 3597 }, 3598 }, {name: "failed default match an input string against a string condition in realm field", 3599 condition: ` match realm foobar`, 3600 values: map[string]interface{}{ 3601 "data": "foobar", 3602 }, 3603 want: map[string]interface{}{ 3604 "match": true, 3605 }, 3606 }, {name: "default match an input string against a string condition in realm field", 3607 condition: ` match realm foobar`, 3608 values: map[string]interface{}{ 3609 "data": "billy", 3610 }, 3611 want: map[string]interface{}{ 3612 "match": false, 3613 }, 3614 }, {name: "failed partial match an input string against a list of strings in realm field", 3615 condition: `partial match realm barfoo foobar`, 3616 values: map[string]interface{}{ 3617 "data": "foobar", 3618 }, 3619 want: map[string]interface{}{ 3620 "match": true, 3621 }, 3622 }, {name: "partial match an input string against a list of strings in realm field", 3623 condition: `partial match realm barfoo foobar`, 3624 values: map[string]interface{}{ 3625 "data": "billy", 3626 }, 3627 want: map[string]interface{}{ 3628 "match": false, 3629 }, 3630 }, {name: "failed partial match an input string against a string condition in realm field", 3631 condition: `partial match realm foobar`, 3632 values: map[string]interface{}{ 3633 "data": "foobar", 3634 }, 3635 want: map[string]interface{}{ 3636 "match": true, 3637 }, 3638 }, {name: "partial match an input string against a string condition in realm field", 3639 condition: `partial match realm foobar`, 3640 values: map[string]interface{}{ 3641 "data": "billy", 3642 }, 3643 want: map[string]interface{}{ 3644 "match": false, 3645 }, 3646 }, {name: "failed prefix match an input string against a list of strings in realm field", 3647 condition: `prefix match realm barfoo foobar`, 3648 values: map[string]interface{}{ 3649 "data": "foobar", 3650 }, 3651 want: map[string]interface{}{ 3652 "match": true, 3653 }, 3654 }, {name: "prefix match an input string against a list of strings in realm field", 3655 condition: `prefix match realm barfoo foobar`, 3656 values: map[string]interface{}{ 3657 "data": "billy", 3658 }, 3659 want: map[string]interface{}{ 3660 "match": false, 3661 }, 3662 }, {name: "failed prefix match an input string against a string condition in realm field", 3663 condition: `prefix match realm foobar`, 3664 values: map[string]interface{}{ 3665 "data": "foobar", 3666 }, 3667 want: map[string]interface{}{ 3668 "match": true, 3669 }, 3670 }, {name: "prefix match an input string against a string condition in realm field", 3671 condition: `prefix match realm foobar`, 3672 values: map[string]interface{}{ 3673 "data": "billy", 3674 }, 3675 want: map[string]interface{}{ 3676 "match": false, 3677 }, 3678 }, {name: "failed suffix match an input string against a list of strings in realm field", 3679 condition: `suffix match realm barfoo foobar`, 3680 values: map[string]interface{}{ 3681 "data": "foobar", 3682 }, 3683 want: map[string]interface{}{ 3684 "match": true, 3685 }, 3686 }, {name: "suffix match an input string against a list of strings in realm field", 3687 condition: `suffix match realm barfoo foobar`, 3688 values: map[string]interface{}{ 3689 "data": "billy", 3690 }, 3691 want: map[string]interface{}{ 3692 "match": false, 3693 }, 3694 }, {name: "failed suffix match an input string against a string condition in realm field", 3695 condition: `suffix match realm foobar`, 3696 values: map[string]interface{}{ 3697 "data": "foobar", 3698 }, 3699 want: map[string]interface{}{ 3700 "match": true, 3701 }, 3702 }, {name: "suffix match an input string against a string condition in realm field", 3703 condition: `suffix match realm foobar`, 3704 values: map[string]interface{}{ 3705 "data": "billy", 3706 }, 3707 want: map[string]interface{}{ 3708 "match": false, 3709 }, 3710 }, {name: "failed regex match an input string against a list of strings in realm field", 3711 condition: `regex match realm barfoo foobar`, 3712 values: map[string]interface{}{ 3713 "data": "foobar", 3714 }, 3715 want: map[string]interface{}{ 3716 "match": true, 3717 }, 3718 }, {name: "regex match an input string against a list of strings in realm field", 3719 condition: `regex match realm barfoo foobar`, 3720 values: map[string]interface{}{ 3721 "data": "billy", 3722 }, 3723 want: map[string]interface{}{ 3724 "match": false, 3725 }, 3726 }, {name: "failed regex match an input string against a string condition in realm field", 3727 condition: `regex match realm foobar`, 3728 values: map[string]interface{}{ 3729 "data": "foobar", 3730 }, 3731 want: map[string]interface{}{ 3732 "match": true, 3733 }, 3734 }, {name: "regex match an input string against a string condition in realm field", 3735 condition: `regex match realm foobar`, 3736 values: map[string]interface{}{ 3737 "data": "billy", 3738 }, 3739 want: map[string]interface{}{ 3740 "match": false, 3741 }, 3742 }, {name: "failed exact match a list of strings input against a list of strings in aud field", 3743 condition: `exact match aud barfoo foobar`, 3744 values: map[string]interface{}{ 3745 "data": []string{"oograb", "foobar"}, 3746 }, 3747 want: map[string]interface{}{ 3748 "match": true, 3749 }, 3750 }, {name: "exact match a list of strings input against a list of strings in aud field", 3751 condition: `exact match aud barfoo foobar`, 3752 values: map[string]interface{}{ 3753 "data": []string{"billy", "bones"}, 3754 }, 3755 want: map[string]interface{}{ 3756 "match": false, 3757 }, 3758 }, {name: "failed default match a list of strings input against a list of strings in aud field", 3759 condition: ` match aud barfoo foobar`, 3760 values: map[string]interface{}{ 3761 "data": []string{"oograb", "foobar"}, 3762 }, 3763 want: map[string]interface{}{ 3764 "match": true, 3765 }, 3766 }, {name: "default match a list of strings input against a list of strings in aud field", 3767 condition: ` match aud barfoo foobar`, 3768 values: map[string]interface{}{ 3769 "data": []string{"billy", "bones"}, 3770 }, 3771 want: map[string]interface{}{ 3772 "match": false, 3773 }, 3774 }, {name: "failed exact match a list of strings input against a string condition in aud field", 3775 condition: `exact match aud foobar`, 3776 values: map[string]interface{}{ 3777 "data": []string{"oograb", "foobar"}, 3778 }, 3779 want: map[string]interface{}{ 3780 "match": true, 3781 }, 3782 }, {name: "exact match a list of strings input against a string condition in aud field", 3783 condition: `exact match aud foobar`, 3784 values: map[string]interface{}{ 3785 "data": []string{"billy", "bones"}, 3786 }, 3787 want: map[string]interface{}{ 3788 "match": false, 3789 }, 3790 }, {name: "failed default match a list of strings input against a string condition in aud field", 3791 condition: ` match aud foobar`, 3792 values: map[string]interface{}{ 3793 "data": []string{"oograb", "foobar"}, 3794 }, 3795 want: map[string]interface{}{ 3796 "match": true, 3797 }, 3798 }, {name: "default match a list of strings input against a string condition in aud field", 3799 condition: ` match aud foobar`, 3800 values: map[string]interface{}{ 3801 "data": []string{"billy", "bones"}, 3802 }, 3803 want: map[string]interface{}{ 3804 "match": false, 3805 }, 3806 }, {name: "failed partial match a list of strings input against a list of strings in aud field", 3807 condition: `partial match aud barfoo foobar`, 3808 values: map[string]interface{}{ 3809 "data": []string{"oograb", "foobar"}, 3810 }, 3811 want: map[string]interface{}{ 3812 "match": true, 3813 }, 3814 }, {name: "partial match a list of strings input against a list of strings in aud field", 3815 condition: `partial match aud barfoo foobar`, 3816 values: map[string]interface{}{ 3817 "data": []string{"billy", "bones"}, 3818 }, 3819 want: map[string]interface{}{ 3820 "match": false, 3821 }, 3822 }, {name: "failed partial match a list of strings input against a string condition in aud field", 3823 condition: `partial match aud foobar`, 3824 values: map[string]interface{}{ 3825 "data": []string{"oograb", "foobar"}, 3826 }, 3827 want: map[string]interface{}{ 3828 "match": true, 3829 }, 3830 }, {name: "partial match a list of strings input against a string condition in aud field", 3831 condition: `partial match aud foobar`, 3832 values: map[string]interface{}{ 3833 "data": []string{"billy", "bones"}, 3834 }, 3835 want: map[string]interface{}{ 3836 "match": false, 3837 }, 3838 }, {name: "failed prefix match a list of strings input against a list of strings in aud field", 3839 condition: `prefix match aud barfoo foobar`, 3840 values: map[string]interface{}{ 3841 "data": []string{"oograb", "foobar"}, 3842 }, 3843 want: map[string]interface{}{ 3844 "match": true, 3845 }, 3846 }, {name: "prefix match a list of strings input against a list of strings in aud field", 3847 condition: `prefix match aud barfoo foobar`, 3848 values: map[string]interface{}{ 3849 "data": []string{"billy", "bones"}, 3850 }, 3851 want: map[string]interface{}{ 3852 "match": false, 3853 }, 3854 }, {name: "failed prefix match a list of strings input against a string condition in aud field", 3855 condition: `prefix match aud foobar`, 3856 values: map[string]interface{}{ 3857 "data": []string{"oograb", "foobar"}, 3858 }, 3859 want: map[string]interface{}{ 3860 "match": true, 3861 }, 3862 }, {name: "prefix match a list of strings input against a string condition in aud field", 3863 condition: `prefix match aud foobar`, 3864 values: map[string]interface{}{ 3865 "data": []string{"billy", "bones"}, 3866 }, 3867 want: map[string]interface{}{ 3868 "match": false, 3869 }, 3870 }, {name: "failed suffix match a list of strings input against a list of strings in aud field", 3871 condition: `suffix match aud barfoo foobar`, 3872 values: map[string]interface{}{ 3873 "data": []string{"oograb", "foobar"}, 3874 }, 3875 want: map[string]interface{}{ 3876 "match": true, 3877 }, 3878 }, {name: "suffix match a list of strings input against a list of strings in aud field", 3879 condition: `suffix match aud barfoo foobar`, 3880 values: map[string]interface{}{ 3881 "data": []string{"billy", "bones"}, 3882 }, 3883 want: map[string]interface{}{ 3884 "match": false, 3885 }, 3886 }, {name: "failed suffix match a list of strings input against a string condition in aud field", 3887 condition: `suffix match aud foobar`, 3888 values: map[string]interface{}{ 3889 "data": []string{"oograb", "foobar"}, 3890 }, 3891 want: map[string]interface{}{ 3892 "match": true, 3893 }, 3894 }, {name: "suffix match a list of strings input against a string condition in aud field", 3895 condition: `suffix match aud foobar`, 3896 values: map[string]interface{}{ 3897 "data": []string{"billy", "bones"}, 3898 }, 3899 want: map[string]interface{}{ 3900 "match": false, 3901 }, 3902 }, {name: "failed regex match a list of strings input against a list of strings in aud field", 3903 condition: `regex match aud barfoo foobar`, 3904 values: map[string]interface{}{ 3905 "data": []string{"oograb", "foobar"}, 3906 }, 3907 want: map[string]interface{}{ 3908 "match": true, 3909 }, 3910 }, {name: "regex match a list of strings input against a list of strings in aud field", 3911 condition: `regex match aud barfoo foobar`, 3912 values: map[string]interface{}{ 3913 "data": []string{"billy", "bones"}, 3914 }, 3915 want: map[string]interface{}{ 3916 "match": false, 3917 }, 3918 }, {name: "failed regex match a list of strings input against a string condition in aud field", 3919 condition: `regex match aud foobar`, 3920 values: map[string]interface{}{ 3921 "data": []string{"oograb", "foobar"}, 3922 }, 3923 want: map[string]interface{}{ 3924 "match": true, 3925 }, 3926 }, {name: "regex match a list of strings input against a string condition in aud field", 3927 condition: `regex match aud foobar`, 3928 values: map[string]interface{}{ 3929 "data": []string{"billy", "bones"}, 3930 }, 3931 want: map[string]interface{}{ 3932 "match": false, 3933 }, 3934 }, {name: "failed exact match a list of strings input against a list of strings in scopes field", 3935 condition: `exact match scopes barfoo foobar`, 3936 values: map[string]interface{}{ 3937 "data": []string{"oograb", "foobar"}, 3938 }, 3939 want: map[string]interface{}{ 3940 "match": true, 3941 }, 3942 }, {name: "exact match a list of strings input against a list of strings in scopes field", 3943 condition: `exact match scopes barfoo foobar`, 3944 values: map[string]interface{}{ 3945 "data": []string{"billy", "bones"}, 3946 }, 3947 want: map[string]interface{}{ 3948 "match": false, 3949 }, 3950 }, {name: "failed default match a list of strings input against a list of strings in scopes field", 3951 condition: ` match scopes barfoo foobar`, 3952 values: map[string]interface{}{ 3953 "data": []string{"oograb", "foobar"}, 3954 }, 3955 want: map[string]interface{}{ 3956 "match": true, 3957 }, 3958 }, {name: "default match a list of strings input against a list of strings in scopes field", 3959 condition: ` match scopes barfoo foobar`, 3960 values: map[string]interface{}{ 3961 "data": []string{"billy", "bones"}, 3962 }, 3963 want: map[string]interface{}{ 3964 "match": false, 3965 }, 3966 }, {name: "failed exact match a list of strings input against a string condition in scopes field", 3967 condition: `exact match scopes foobar`, 3968 values: map[string]interface{}{ 3969 "data": []string{"oograb", "foobar"}, 3970 }, 3971 want: map[string]interface{}{ 3972 "match": true, 3973 }, 3974 }, {name: "exact match a list of strings input against a string condition in scopes field", 3975 condition: `exact match scopes foobar`, 3976 values: map[string]interface{}{ 3977 "data": []string{"billy", "bones"}, 3978 }, 3979 want: map[string]interface{}{ 3980 "match": false, 3981 }, 3982 }, {name: "failed default match a list of strings input against a string condition in scopes field", 3983 condition: ` match scopes foobar`, 3984 values: map[string]interface{}{ 3985 "data": []string{"oograb", "foobar"}, 3986 }, 3987 want: map[string]interface{}{ 3988 "match": true, 3989 }, 3990 }, {name: "default match a list of strings input against a string condition in scopes field", 3991 condition: ` match scopes foobar`, 3992 values: map[string]interface{}{ 3993 "data": []string{"billy", "bones"}, 3994 }, 3995 want: map[string]interface{}{ 3996 "match": false, 3997 }, 3998 }, {name: "failed partial match a list of strings input against a list of strings in scopes field", 3999 condition: `partial match scopes barfoo foobar`, 4000 values: map[string]interface{}{ 4001 "data": []string{"oograb", "foobar"}, 4002 }, 4003 want: map[string]interface{}{ 4004 "match": true, 4005 }, 4006 }, {name: "partial match a list of strings input against a list of strings in scopes field", 4007 condition: `partial match scopes barfoo foobar`, 4008 values: map[string]interface{}{ 4009 "data": []string{"billy", "bones"}, 4010 }, 4011 want: map[string]interface{}{ 4012 "match": false, 4013 }, 4014 }, {name: "failed partial match a list of strings input against a string condition in scopes field", 4015 condition: `partial match scopes foobar`, 4016 values: map[string]interface{}{ 4017 "data": []string{"oograb", "foobar"}, 4018 }, 4019 want: map[string]interface{}{ 4020 "match": true, 4021 }, 4022 }, {name: "partial match a list of strings input against a string condition in scopes field", 4023 condition: `partial match scopes foobar`, 4024 values: map[string]interface{}{ 4025 "data": []string{"billy", "bones"}, 4026 }, 4027 want: map[string]interface{}{ 4028 "match": false, 4029 }, 4030 }, {name: "failed prefix match a list of strings input against a list of strings in scopes field", 4031 condition: `prefix match scopes barfoo foobar`, 4032 values: map[string]interface{}{ 4033 "data": []string{"oograb", "foobar"}, 4034 }, 4035 want: map[string]interface{}{ 4036 "match": true, 4037 }, 4038 }, {name: "prefix match a list of strings input against a list of strings in scopes field", 4039 condition: `prefix match scopes barfoo foobar`, 4040 values: map[string]interface{}{ 4041 "data": []string{"billy", "bones"}, 4042 }, 4043 want: map[string]interface{}{ 4044 "match": false, 4045 }, 4046 }, {name: "failed prefix match a list of strings input against a string condition in scopes field", 4047 condition: `prefix match scopes foobar`, 4048 values: map[string]interface{}{ 4049 "data": []string{"oograb", "foobar"}, 4050 }, 4051 want: map[string]interface{}{ 4052 "match": true, 4053 }, 4054 }, {name: "prefix match a list of strings input against a string condition in scopes field", 4055 condition: `prefix match scopes foobar`, 4056 values: map[string]interface{}{ 4057 "data": []string{"billy", "bones"}, 4058 }, 4059 want: map[string]interface{}{ 4060 "match": false, 4061 }, 4062 }, {name: "failed suffix match a list of strings input against a list of strings in scopes field", 4063 condition: `suffix match scopes barfoo foobar`, 4064 values: map[string]interface{}{ 4065 "data": []string{"oograb", "foobar"}, 4066 }, 4067 want: map[string]interface{}{ 4068 "match": true, 4069 }, 4070 }, {name: "suffix match a list of strings input against a list of strings in scopes field", 4071 condition: `suffix match scopes barfoo foobar`, 4072 values: map[string]interface{}{ 4073 "data": []string{"billy", "bones"}, 4074 }, 4075 want: map[string]interface{}{ 4076 "match": false, 4077 }, 4078 }, {name: "failed suffix match a list of strings input against a string condition in scopes field", 4079 condition: `suffix match scopes foobar`, 4080 values: map[string]interface{}{ 4081 "data": []string{"oograb", "foobar"}, 4082 }, 4083 want: map[string]interface{}{ 4084 "match": true, 4085 }, 4086 }, {name: "suffix match a list of strings input against a string condition in scopes field", 4087 condition: `suffix match scopes foobar`, 4088 values: map[string]interface{}{ 4089 "data": []string{"billy", "bones"}, 4090 }, 4091 want: map[string]interface{}{ 4092 "match": false, 4093 }, 4094 }, {name: "failed regex match a list of strings input against a list of strings in scopes field", 4095 condition: `regex match scopes barfoo foobar`, 4096 values: map[string]interface{}{ 4097 "data": []string{"oograb", "foobar"}, 4098 }, 4099 want: map[string]interface{}{ 4100 "match": true, 4101 }, 4102 }, {name: "regex match a list of strings input against a list of strings in scopes field", 4103 condition: `regex match scopes barfoo foobar`, 4104 values: map[string]interface{}{ 4105 "data": []string{"billy", "bones"}, 4106 }, 4107 want: map[string]interface{}{ 4108 "match": false, 4109 }, 4110 }, {name: "failed regex match a list of strings input against a string condition in scopes field", 4111 condition: `regex match scopes foobar`, 4112 values: map[string]interface{}{ 4113 "data": []string{"oograb", "foobar"}, 4114 }, 4115 want: map[string]interface{}{ 4116 "match": true, 4117 }, 4118 }, {name: "regex match a list of strings input against a string condition in scopes field", 4119 condition: `regex match scopes foobar`, 4120 values: map[string]interface{}{ 4121 "data": []string{"billy", "bones"}, 4122 }, 4123 want: map[string]interface{}{ 4124 "match": false, 4125 }, 4126 }, {name: "failed exact match a list of strings input against a list of strings in org field", 4127 condition: `exact match org barfoo foobar`, 4128 values: map[string]interface{}{ 4129 "data": []string{"oograb", "foobar"}, 4130 }, 4131 want: map[string]interface{}{ 4132 "match": true, 4133 }, 4134 }, {name: "exact match a list of strings input against a list of strings in org field", 4135 condition: `exact match org barfoo foobar`, 4136 values: map[string]interface{}{ 4137 "data": []string{"billy", "bones"}, 4138 }, 4139 want: map[string]interface{}{ 4140 "match": false, 4141 }, 4142 }, {name: "failed default match a list of strings input against a list of strings in org field", 4143 condition: ` match org barfoo foobar`, 4144 values: map[string]interface{}{ 4145 "data": []string{"oograb", "foobar"}, 4146 }, 4147 want: map[string]interface{}{ 4148 "match": true, 4149 }, 4150 }, {name: "default match a list of strings input against a list of strings in org field", 4151 condition: ` match org barfoo foobar`, 4152 values: map[string]interface{}{ 4153 "data": []string{"billy", "bones"}, 4154 }, 4155 want: map[string]interface{}{ 4156 "match": false, 4157 }, 4158 }, {name: "failed exact match a list of strings input against a string condition in org field", 4159 condition: `exact match org foobar`, 4160 values: map[string]interface{}{ 4161 "data": []string{"oograb", "foobar"}, 4162 }, 4163 want: map[string]interface{}{ 4164 "match": true, 4165 }, 4166 }, {name: "exact match a list of strings input against a string condition in org field", 4167 condition: `exact match org foobar`, 4168 values: map[string]interface{}{ 4169 "data": []string{"billy", "bones"}, 4170 }, 4171 want: map[string]interface{}{ 4172 "match": false, 4173 }, 4174 }, {name: "failed default match a list of strings input against a string condition in org field", 4175 condition: ` match org foobar`, 4176 values: map[string]interface{}{ 4177 "data": []string{"oograb", "foobar"}, 4178 }, 4179 want: map[string]interface{}{ 4180 "match": true, 4181 }, 4182 }, {name: "default match a list of strings input against a string condition in org field", 4183 condition: ` match org foobar`, 4184 values: map[string]interface{}{ 4185 "data": []string{"billy", "bones"}, 4186 }, 4187 want: map[string]interface{}{ 4188 "match": false, 4189 }, 4190 }, {name: "failed partial match a list of strings input against a list of strings in org field", 4191 condition: `partial match org barfoo foobar`, 4192 values: map[string]interface{}{ 4193 "data": []string{"oograb", "foobar"}, 4194 }, 4195 want: map[string]interface{}{ 4196 "match": true, 4197 }, 4198 }, {name: "partial match a list of strings input against a list of strings in org field", 4199 condition: `partial match org barfoo foobar`, 4200 values: map[string]interface{}{ 4201 "data": []string{"billy", "bones"}, 4202 }, 4203 want: map[string]interface{}{ 4204 "match": false, 4205 }, 4206 }, {name: "failed partial match a list of strings input against a string condition in org field", 4207 condition: `partial match org foobar`, 4208 values: map[string]interface{}{ 4209 "data": []string{"oograb", "foobar"}, 4210 }, 4211 want: map[string]interface{}{ 4212 "match": true, 4213 }, 4214 }, {name: "partial match a list of strings input against a string condition in org field", 4215 condition: `partial match org foobar`, 4216 values: map[string]interface{}{ 4217 "data": []string{"billy", "bones"}, 4218 }, 4219 want: map[string]interface{}{ 4220 "match": false, 4221 }, 4222 }, {name: "failed prefix match a list of strings input against a list of strings in org field", 4223 condition: `prefix match org barfoo foobar`, 4224 values: map[string]interface{}{ 4225 "data": []string{"oograb", "foobar"}, 4226 }, 4227 want: map[string]interface{}{ 4228 "match": true, 4229 }, 4230 }, {name: "prefix match a list of strings input against a list of strings in org field", 4231 condition: `prefix match org barfoo foobar`, 4232 values: map[string]interface{}{ 4233 "data": []string{"billy", "bones"}, 4234 }, 4235 want: map[string]interface{}{ 4236 "match": false, 4237 }, 4238 }, {name: "failed prefix match a list of strings input against a string condition in org field", 4239 condition: `prefix match org foobar`, 4240 values: map[string]interface{}{ 4241 "data": []string{"oograb", "foobar"}, 4242 }, 4243 want: map[string]interface{}{ 4244 "match": true, 4245 }, 4246 }, {name: "prefix match a list of strings input against a string condition in org field", 4247 condition: `prefix match org foobar`, 4248 values: map[string]interface{}{ 4249 "data": []string{"billy", "bones"}, 4250 }, 4251 want: map[string]interface{}{ 4252 "match": false, 4253 }, 4254 }, {name: "failed suffix match a list of strings input against a list of strings in org field", 4255 condition: `suffix match org barfoo foobar`, 4256 values: map[string]interface{}{ 4257 "data": []string{"oograb", "foobar"}, 4258 }, 4259 want: map[string]interface{}{ 4260 "match": true, 4261 }, 4262 }, {name: "suffix match a list of strings input against a list of strings in org field", 4263 condition: `suffix match org barfoo foobar`, 4264 values: map[string]interface{}{ 4265 "data": []string{"billy", "bones"}, 4266 }, 4267 want: map[string]interface{}{ 4268 "match": false, 4269 }, 4270 }, {name: "failed suffix match a list of strings input against a string condition in org field", 4271 condition: `suffix match org foobar`, 4272 values: map[string]interface{}{ 4273 "data": []string{"oograb", "foobar"}, 4274 }, 4275 want: map[string]interface{}{ 4276 "match": true, 4277 }, 4278 }, {name: "suffix match a list of strings input against a string condition in org field", 4279 condition: `suffix match org foobar`, 4280 values: map[string]interface{}{ 4281 "data": []string{"billy", "bones"}, 4282 }, 4283 want: map[string]interface{}{ 4284 "match": false, 4285 }, 4286 }, {name: "failed regex match a list of strings input against a list of strings in org field", 4287 condition: `regex match org barfoo foobar`, 4288 values: map[string]interface{}{ 4289 "data": []string{"oograb", "foobar"}, 4290 }, 4291 want: map[string]interface{}{ 4292 "match": true, 4293 }, 4294 }, {name: "regex match a list of strings input against a list of strings in org field", 4295 condition: `regex match org barfoo foobar`, 4296 values: map[string]interface{}{ 4297 "data": []string{"billy", "bones"}, 4298 }, 4299 want: map[string]interface{}{ 4300 "match": false, 4301 }, 4302 }, {name: "failed regex match a list of strings input against a string condition in org field", 4303 condition: `regex match org foobar`, 4304 values: map[string]interface{}{ 4305 "data": []string{"oograb", "foobar"}, 4306 }, 4307 want: map[string]interface{}{ 4308 "match": true, 4309 }, 4310 }, {name: "regex match a list of strings input against a string condition in org field", 4311 condition: `regex match org foobar`, 4312 values: map[string]interface{}{ 4313 "data": []string{"billy", "bones"}, 4314 }, 4315 want: map[string]interface{}{ 4316 "match": false, 4317 }, 4318 }, {name: "failed exact match an input string against a list of strings in jti field", 4319 condition: `exact match jti barfoo foobar`, 4320 values: map[string]interface{}{ 4321 "data": "foobar", 4322 }, 4323 want: map[string]interface{}{ 4324 "match": true, 4325 }, 4326 }, {name: "exact match an input string against a list of strings in jti field", 4327 condition: `exact match jti barfoo foobar`, 4328 values: map[string]interface{}{ 4329 "data": "billy", 4330 }, 4331 want: map[string]interface{}{ 4332 "match": false, 4333 }, 4334 }, {name: "failed default match an input string against a list of strings in jti field", 4335 condition: ` match jti barfoo foobar`, 4336 values: map[string]interface{}{ 4337 "data": "foobar", 4338 }, 4339 want: map[string]interface{}{ 4340 "match": true, 4341 }, 4342 }, {name: "default match an input string against a list of strings in jti field", 4343 condition: ` match jti barfoo foobar`, 4344 values: map[string]interface{}{ 4345 "data": "billy", 4346 }, 4347 want: map[string]interface{}{ 4348 "match": false, 4349 }, 4350 }, {name: "failed exact match an input string against a string condition in jti field", 4351 condition: `exact match jti foobar`, 4352 values: map[string]interface{}{ 4353 "data": "foobar", 4354 }, 4355 want: map[string]interface{}{ 4356 "match": true, 4357 }, 4358 }, {name: "exact match an input string against a string condition in jti field", 4359 condition: `exact match jti foobar`, 4360 values: map[string]interface{}{ 4361 "data": "billy", 4362 }, 4363 want: map[string]interface{}{ 4364 "match": false, 4365 }, 4366 }, {name: "failed default match an input string against a string condition in jti field", 4367 condition: ` match jti foobar`, 4368 values: map[string]interface{}{ 4369 "data": "foobar", 4370 }, 4371 want: map[string]interface{}{ 4372 "match": true, 4373 }, 4374 }, {name: "default match an input string against a string condition in jti field", 4375 condition: ` match jti foobar`, 4376 values: map[string]interface{}{ 4377 "data": "billy", 4378 }, 4379 want: map[string]interface{}{ 4380 "match": false, 4381 }, 4382 }, {name: "failed partial match an input string against a list of strings in jti field", 4383 condition: `partial match jti barfoo foobar`, 4384 values: map[string]interface{}{ 4385 "data": "foobar", 4386 }, 4387 want: map[string]interface{}{ 4388 "match": true, 4389 }, 4390 }, {name: "partial match an input string against a list of strings in jti field", 4391 condition: `partial match jti barfoo foobar`, 4392 values: map[string]interface{}{ 4393 "data": "billy", 4394 }, 4395 want: map[string]interface{}{ 4396 "match": false, 4397 }, 4398 }, {name: "failed partial match an input string against a string condition in jti field", 4399 condition: `partial match jti foobar`, 4400 values: map[string]interface{}{ 4401 "data": "foobar", 4402 }, 4403 want: map[string]interface{}{ 4404 "match": true, 4405 }, 4406 }, {name: "partial match an input string against a string condition in jti field", 4407 condition: `partial match jti foobar`, 4408 values: map[string]interface{}{ 4409 "data": "billy", 4410 }, 4411 want: map[string]interface{}{ 4412 "match": false, 4413 }, 4414 }, {name: "failed prefix match an input string against a list of strings in jti field", 4415 condition: `prefix match jti barfoo foobar`, 4416 values: map[string]interface{}{ 4417 "data": "foobar", 4418 }, 4419 want: map[string]interface{}{ 4420 "match": true, 4421 }, 4422 }, {name: "prefix match an input string against a list of strings in jti field", 4423 condition: `prefix match jti barfoo foobar`, 4424 values: map[string]interface{}{ 4425 "data": "billy", 4426 }, 4427 want: map[string]interface{}{ 4428 "match": false, 4429 }, 4430 }, {name: "failed prefix match an input string against a string condition in jti field", 4431 condition: `prefix match jti foobar`, 4432 values: map[string]interface{}{ 4433 "data": "foobar", 4434 }, 4435 want: map[string]interface{}{ 4436 "match": true, 4437 }, 4438 }, {name: "prefix match an input string against a string condition in jti field", 4439 condition: `prefix match jti foobar`, 4440 values: map[string]interface{}{ 4441 "data": "billy", 4442 }, 4443 want: map[string]interface{}{ 4444 "match": false, 4445 }, 4446 }, {name: "failed suffix match an input string against a list of strings in jti field", 4447 condition: `suffix match jti barfoo foobar`, 4448 values: map[string]interface{}{ 4449 "data": "foobar", 4450 }, 4451 want: map[string]interface{}{ 4452 "match": true, 4453 }, 4454 }, {name: "suffix match an input string against a list of strings in jti field", 4455 condition: `suffix match jti barfoo foobar`, 4456 values: map[string]interface{}{ 4457 "data": "billy", 4458 }, 4459 want: map[string]interface{}{ 4460 "match": false, 4461 }, 4462 }, {name: "failed suffix match an input string against a string condition in jti field", 4463 condition: `suffix match jti foobar`, 4464 values: map[string]interface{}{ 4465 "data": "foobar", 4466 }, 4467 want: map[string]interface{}{ 4468 "match": true, 4469 }, 4470 }, {name: "suffix match an input string against a string condition in jti field", 4471 condition: `suffix match jti foobar`, 4472 values: map[string]interface{}{ 4473 "data": "billy", 4474 }, 4475 want: map[string]interface{}{ 4476 "match": false, 4477 }, 4478 }, {name: "failed regex match an input string against a list of strings in jti field", 4479 condition: `regex match jti barfoo foobar`, 4480 values: map[string]interface{}{ 4481 "data": "foobar", 4482 }, 4483 want: map[string]interface{}{ 4484 "match": true, 4485 }, 4486 }, {name: "regex match an input string against a list of strings in jti field", 4487 condition: `regex match jti barfoo foobar`, 4488 values: map[string]interface{}{ 4489 "data": "billy", 4490 }, 4491 want: map[string]interface{}{ 4492 "match": false, 4493 }, 4494 }, {name: "failed regex match an input string against a string condition in jti field", 4495 condition: `regex match jti foobar`, 4496 values: map[string]interface{}{ 4497 "data": "foobar", 4498 }, 4499 want: map[string]interface{}{ 4500 "match": true, 4501 }, 4502 }, {name: "regex match an input string against a string condition in jti field", 4503 condition: `regex match jti foobar`, 4504 values: map[string]interface{}{ 4505 "data": "billy", 4506 }, 4507 want: map[string]interface{}{ 4508 "match": false, 4509 }, 4510 }, {name: "failed exact match an input string against a list of strings in iss field", 4511 condition: `exact match iss barfoo foobar`, 4512 values: map[string]interface{}{ 4513 "data": "foobar", 4514 }, 4515 want: map[string]interface{}{ 4516 "match": true, 4517 }, 4518 }, {name: "exact match an input string against a list of strings in iss field", 4519 condition: `exact match iss barfoo foobar`, 4520 values: map[string]interface{}{ 4521 "data": "billy", 4522 }, 4523 want: map[string]interface{}{ 4524 "match": false, 4525 }, 4526 }, {name: "failed default match an input string against a list of strings in iss field", 4527 condition: ` match iss barfoo foobar`, 4528 values: map[string]interface{}{ 4529 "data": "foobar", 4530 }, 4531 want: map[string]interface{}{ 4532 "match": true, 4533 }, 4534 }, {name: "default match an input string against a list of strings in iss field", 4535 condition: ` match iss barfoo foobar`, 4536 values: map[string]interface{}{ 4537 "data": "billy", 4538 }, 4539 want: map[string]interface{}{ 4540 "match": false, 4541 }, 4542 }, {name: "failed exact match an input string against a string condition in iss field", 4543 condition: `exact match iss foobar`, 4544 values: map[string]interface{}{ 4545 "data": "foobar", 4546 }, 4547 want: map[string]interface{}{ 4548 "match": true, 4549 }, 4550 }, {name: "exact match an input string against a string condition in iss field", 4551 condition: `exact match iss foobar`, 4552 values: map[string]interface{}{ 4553 "data": "billy", 4554 }, 4555 want: map[string]interface{}{ 4556 "match": false, 4557 }, 4558 }, {name: "failed default match an input string against a string condition in iss field", 4559 condition: ` match iss foobar`, 4560 values: map[string]interface{}{ 4561 "data": "foobar", 4562 }, 4563 want: map[string]interface{}{ 4564 "match": true, 4565 }, 4566 }, {name: "default match an input string against a string condition in iss field", 4567 condition: ` match iss foobar`, 4568 values: map[string]interface{}{ 4569 "data": "billy", 4570 }, 4571 want: map[string]interface{}{ 4572 "match": false, 4573 }, 4574 }, {name: "failed partial match an input string against a list of strings in iss field", 4575 condition: `partial match iss barfoo foobar`, 4576 values: map[string]interface{}{ 4577 "data": "foobar", 4578 }, 4579 want: map[string]interface{}{ 4580 "match": true, 4581 }, 4582 }, {name: "partial match an input string against a list of strings in iss field", 4583 condition: `partial match iss barfoo foobar`, 4584 values: map[string]interface{}{ 4585 "data": "billy", 4586 }, 4587 want: map[string]interface{}{ 4588 "match": false, 4589 }, 4590 }, {name: "failed partial match an input string against a string condition in iss field", 4591 condition: `partial match iss foobar`, 4592 values: map[string]interface{}{ 4593 "data": "foobar", 4594 }, 4595 want: map[string]interface{}{ 4596 "match": true, 4597 }, 4598 }, {name: "partial match an input string against a string condition in iss field", 4599 condition: `partial match iss foobar`, 4600 values: map[string]interface{}{ 4601 "data": "billy", 4602 }, 4603 want: map[string]interface{}{ 4604 "match": false, 4605 }, 4606 }, {name: "failed prefix match an input string against a list of strings in iss field", 4607 condition: `prefix match iss barfoo foobar`, 4608 values: map[string]interface{}{ 4609 "data": "foobar", 4610 }, 4611 want: map[string]interface{}{ 4612 "match": true, 4613 }, 4614 }, {name: "prefix match an input string against a list of strings in iss field", 4615 condition: `prefix match iss barfoo foobar`, 4616 values: map[string]interface{}{ 4617 "data": "billy", 4618 }, 4619 want: map[string]interface{}{ 4620 "match": false, 4621 }, 4622 }, {name: "failed prefix match an input string against a string condition in iss field", 4623 condition: `prefix match iss foobar`, 4624 values: map[string]interface{}{ 4625 "data": "foobar", 4626 }, 4627 want: map[string]interface{}{ 4628 "match": true, 4629 }, 4630 }, {name: "prefix match an input string against a string condition in iss field", 4631 condition: `prefix match iss foobar`, 4632 values: map[string]interface{}{ 4633 "data": "billy", 4634 }, 4635 want: map[string]interface{}{ 4636 "match": false, 4637 }, 4638 }, {name: "failed suffix match an input string against a list of strings in iss field", 4639 condition: `suffix match iss barfoo foobar`, 4640 values: map[string]interface{}{ 4641 "data": "foobar", 4642 }, 4643 want: map[string]interface{}{ 4644 "match": true, 4645 }, 4646 }, {name: "suffix match an input string against a list of strings in iss field", 4647 condition: `suffix match iss barfoo foobar`, 4648 values: map[string]interface{}{ 4649 "data": "billy", 4650 }, 4651 want: map[string]interface{}{ 4652 "match": false, 4653 }, 4654 }, {name: "failed suffix match an input string against a string condition in iss field", 4655 condition: `suffix match iss foobar`, 4656 values: map[string]interface{}{ 4657 "data": "foobar", 4658 }, 4659 want: map[string]interface{}{ 4660 "match": true, 4661 }, 4662 }, {name: "suffix match an input string against a string condition in iss field", 4663 condition: `suffix match iss foobar`, 4664 values: map[string]interface{}{ 4665 "data": "billy", 4666 }, 4667 want: map[string]interface{}{ 4668 "match": false, 4669 }, 4670 }, {name: "failed regex match an input string against a list of strings in iss field", 4671 condition: `regex match iss barfoo foobar`, 4672 values: map[string]interface{}{ 4673 "data": "foobar", 4674 }, 4675 want: map[string]interface{}{ 4676 "match": true, 4677 }, 4678 }, {name: "regex match an input string against a list of strings in iss field", 4679 condition: `regex match iss barfoo foobar`, 4680 values: map[string]interface{}{ 4681 "data": "billy", 4682 }, 4683 want: map[string]interface{}{ 4684 "match": false, 4685 }, 4686 }, {name: "failed regex match an input string against a string condition in iss field", 4687 condition: `regex match iss foobar`, 4688 values: map[string]interface{}{ 4689 "data": "foobar", 4690 }, 4691 want: map[string]interface{}{ 4692 "match": true, 4693 }, 4694 }, {name: "regex match an input string against a string condition in iss field", 4695 condition: `regex match iss foobar`, 4696 values: map[string]interface{}{ 4697 "data": "billy", 4698 }, 4699 want: map[string]interface{}{ 4700 "match": false, 4701 }, 4702 }, {name: "failed exact match an input string against a list of strings in sub field", 4703 condition: `exact match sub barfoo foobar`, 4704 values: map[string]interface{}{ 4705 "data": "foobar", 4706 }, 4707 want: map[string]interface{}{ 4708 "match": true, 4709 }, 4710 }, {name: "exact match an input string against a list of strings in sub field", 4711 condition: `exact match sub barfoo foobar`, 4712 values: map[string]interface{}{ 4713 "data": "billy", 4714 }, 4715 want: map[string]interface{}{ 4716 "match": false, 4717 }, 4718 }, {name: "failed default match an input string against a list of strings in sub field", 4719 condition: ` match sub barfoo foobar`, 4720 values: map[string]interface{}{ 4721 "data": "foobar", 4722 }, 4723 want: map[string]interface{}{ 4724 "match": true, 4725 }, 4726 }, {name: "default match an input string against a list of strings in sub field", 4727 condition: ` match sub barfoo foobar`, 4728 values: map[string]interface{}{ 4729 "data": "billy", 4730 }, 4731 want: map[string]interface{}{ 4732 "match": false, 4733 }, 4734 }, {name: "failed exact match an input string against a string condition in sub field", 4735 condition: `exact match sub foobar`, 4736 values: map[string]interface{}{ 4737 "data": "foobar", 4738 }, 4739 want: map[string]interface{}{ 4740 "match": true, 4741 }, 4742 }, {name: "exact match an input string against a string condition in sub field", 4743 condition: `exact match sub foobar`, 4744 values: map[string]interface{}{ 4745 "data": "billy", 4746 }, 4747 want: map[string]interface{}{ 4748 "match": false, 4749 }, 4750 }, {name: "failed default match an input string against a string condition in sub field", 4751 condition: ` match sub foobar`, 4752 values: map[string]interface{}{ 4753 "data": "foobar", 4754 }, 4755 want: map[string]interface{}{ 4756 "match": true, 4757 }, 4758 }, {name: "default match an input string against a string condition in sub field", 4759 condition: ` match sub foobar`, 4760 values: map[string]interface{}{ 4761 "data": "billy", 4762 }, 4763 want: map[string]interface{}{ 4764 "match": false, 4765 }, 4766 }, {name: "failed partial match an input string against a list of strings in sub field", 4767 condition: `partial match sub barfoo foobar`, 4768 values: map[string]interface{}{ 4769 "data": "foobar", 4770 }, 4771 want: map[string]interface{}{ 4772 "match": true, 4773 }, 4774 }, {name: "partial match an input string against a list of strings in sub field", 4775 condition: `partial match sub barfoo foobar`, 4776 values: map[string]interface{}{ 4777 "data": "billy", 4778 }, 4779 want: map[string]interface{}{ 4780 "match": false, 4781 }, 4782 }, {name: "failed partial match an input string against a string condition in sub field", 4783 condition: `partial match sub foobar`, 4784 values: map[string]interface{}{ 4785 "data": "foobar", 4786 }, 4787 want: map[string]interface{}{ 4788 "match": true, 4789 }, 4790 }, {name: "partial match an input string against a string condition in sub field", 4791 condition: `partial match sub foobar`, 4792 values: map[string]interface{}{ 4793 "data": "billy", 4794 }, 4795 want: map[string]interface{}{ 4796 "match": false, 4797 }, 4798 }, {name: "failed prefix match an input string against a list of strings in sub field", 4799 condition: `prefix match sub barfoo foobar`, 4800 values: map[string]interface{}{ 4801 "data": "foobar", 4802 }, 4803 want: map[string]interface{}{ 4804 "match": true, 4805 }, 4806 }, {name: "prefix match an input string against a list of strings in sub field", 4807 condition: `prefix match sub barfoo foobar`, 4808 values: map[string]interface{}{ 4809 "data": "billy", 4810 }, 4811 want: map[string]interface{}{ 4812 "match": false, 4813 }, 4814 }, {name: "failed prefix match an input string against a string condition in sub field", 4815 condition: `prefix match sub foobar`, 4816 values: map[string]interface{}{ 4817 "data": "foobar", 4818 }, 4819 want: map[string]interface{}{ 4820 "match": true, 4821 }, 4822 }, {name: "prefix match an input string against a string condition in sub field", 4823 condition: `prefix match sub foobar`, 4824 values: map[string]interface{}{ 4825 "data": "billy", 4826 }, 4827 want: map[string]interface{}{ 4828 "match": false, 4829 }, 4830 }, {name: "failed suffix match an input string against a list of strings in sub field", 4831 condition: `suffix match sub barfoo foobar`, 4832 values: map[string]interface{}{ 4833 "data": "foobar", 4834 }, 4835 want: map[string]interface{}{ 4836 "match": true, 4837 }, 4838 }, {name: "suffix match an input string against a list of strings in sub field", 4839 condition: `suffix match sub barfoo foobar`, 4840 values: map[string]interface{}{ 4841 "data": "billy", 4842 }, 4843 want: map[string]interface{}{ 4844 "match": false, 4845 }, 4846 }, {name: "failed suffix match an input string against a string condition in sub field", 4847 condition: `suffix match sub foobar`, 4848 values: map[string]interface{}{ 4849 "data": "foobar", 4850 }, 4851 want: map[string]interface{}{ 4852 "match": true, 4853 }, 4854 }, {name: "suffix match an input string against a string condition in sub field", 4855 condition: `suffix match sub foobar`, 4856 values: map[string]interface{}{ 4857 "data": "billy", 4858 }, 4859 want: map[string]interface{}{ 4860 "match": false, 4861 }, 4862 }, {name: "failed regex match an input string against a list of strings in sub field", 4863 condition: `regex match sub barfoo foobar`, 4864 values: map[string]interface{}{ 4865 "data": "foobar", 4866 }, 4867 want: map[string]interface{}{ 4868 "match": true, 4869 }, 4870 }, {name: "regex match an input string against a list of strings in sub field", 4871 condition: `regex match sub barfoo foobar`, 4872 values: map[string]interface{}{ 4873 "data": "billy", 4874 }, 4875 want: map[string]interface{}{ 4876 "match": false, 4877 }, 4878 }, {name: "failed regex match an input string against a string condition in sub field", 4879 condition: `regex match sub foobar`, 4880 values: map[string]interface{}{ 4881 "data": "foobar", 4882 }, 4883 want: map[string]interface{}{ 4884 "match": true, 4885 }, 4886 }, {name: "regex match an input string against a string condition in sub field", 4887 condition: `regex match sub foobar`, 4888 values: map[string]interface{}{ 4889 "data": "billy", 4890 }, 4891 want: map[string]interface{}{ 4892 "match": false, 4893 }, 4894 }, {name: "failed exact match an input string against a list of strings in addr field", 4895 condition: `exact match addr barfoo foobar`, 4896 values: map[string]interface{}{ 4897 "data": "foobar", 4898 }, 4899 want: map[string]interface{}{ 4900 "match": true, 4901 }, 4902 }, {name: "exact match an input string against a list of strings in addr field", 4903 condition: `exact match addr barfoo foobar`, 4904 values: map[string]interface{}{ 4905 "data": "billy", 4906 }, 4907 want: map[string]interface{}{ 4908 "match": false, 4909 }, 4910 }, {name: "failed default match an input string against a list of strings in addr field", 4911 condition: ` match addr barfoo foobar`, 4912 values: map[string]interface{}{ 4913 "data": "foobar", 4914 }, 4915 want: map[string]interface{}{ 4916 "match": true, 4917 }, 4918 }, {name: "default match an input string against a list of strings in addr field", 4919 condition: ` match addr barfoo foobar`, 4920 values: map[string]interface{}{ 4921 "data": "billy", 4922 }, 4923 want: map[string]interface{}{ 4924 "match": false, 4925 }, 4926 }, {name: "failed exact match an input string against a string condition in addr field", 4927 condition: `exact match addr foobar`, 4928 values: map[string]interface{}{ 4929 "data": "foobar", 4930 }, 4931 want: map[string]interface{}{ 4932 "match": true, 4933 }, 4934 }, {name: "exact match an input string against a string condition in addr field", 4935 condition: `exact match addr foobar`, 4936 values: map[string]interface{}{ 4937 "data": "billy", 4938 }, 4939 want: map[string]interface{}{ 4940 "match": false, 4941 }, 4942 }, {name: "failed default match an input string against a string condition in addr field", 4943 condition: ` match addr foobar`, 4944 values: map[string]interface{}{ 4945 "data": "foobar", 4946 }, 4947 want: map[string]interface{}{ 4948 "match": true, 4949 }, 4950 }, {name: "default match an input string against a string condition in addr field", 4951 condition: ` match addr foobar`, 4952 values: map[string]interface{}{ 4953 "data": "billy", 4954 }, 4955 want: map[string]interface{}{ 4956 "match": false, 4957 }, 4958 }, {name: "failed partial match an input string against a list of strings in addr field", 4959 condition: `partial match addr barfoo foobar`, 4960 values: map[string]interface{}{ 4961 "data": "foobar", 4962 }, 4963 want: map[string]interface{}{ 4964 "match": true, 4965 }, 4966 }, {name: "partial match an input string against a list of strings in addr field", 4967 condition: `partial match addr barfoo foobar`, 4968 values: map[string]interface{}{ 4969 "data": "billy", 4970 }, 4971 want: map[string]interface{}{ 4972 "match": false, 4973 }, 4974 }, {name: "failed partial match an input string against a string condition in addr field", 4975 condition: `partial match addr foobar`, 4976 values: map[string]interface{}{ 4977 "data": "foobar", 4978 }, 4979 want: map[string]interface{}{ 4980 "match": true, 4981 }, 4982 }, {name: "partial match an input string against a string condition in addr field", 4983 condition: `partial match addr foobar`, 4984 values: map[string]interface{}{ 4985 "data": "billy", 4986 }, 4987 want: map[string]interface{}{ 4988 "match": false, 4989 }, 4990 }, {name: "failed prefix match an input string against a list of strings in addr field", 4991 condition: `prefix match addr barfoo foobar`, 4992 values: map[string]interface{}{ 4993 "data": "foobar", 4994 }, 4995 want: map[string]interface{}{ 4996 "match": true, 4997 }, 4998 }, {name: "prefix match an input string against a list of strings in addr field", 4999 condition: `prefix match addr barfoo foobar`, 5000 values: map[string]interface{}{ 5001 "data": "billy", 5002 }, 5003 want: map[string]interface{}{ 5004 "match": false, 5005 }, 5006 }, {name: "failed prefix match an input string against a string condition in addr field", 5007 condition: `prefix match addr foobar`, 5008 values: map[string]interface{}{ 5009 "data": "foobar", 5010 }, 5011 want: map[string]interface{}{ 5012 "match": true, 5013 }, 5014 }, {name: "prefix match an input string against a string condition in addr field", 5015 condition: `prefix match addr foobar`, 5016 values: map[string]interface{}{ 5017 "data": "billy", 5018 }, 5019 want: map[string]interface{}{ 5020 "match": false, 5021 }, 5022 }, {name: "failed suffix match an input string against a list of strings in addr field", 5023 condition: `suffix match addr barfoo foobar`, 5024 values: map[string]interface{}{ 5025 "data": "foobar", 5026 }, 5027 want: map[string]interface{}{ 5028 "match": true, 5029 }, 5030 }, {name: "suffix match an input string against a list of strings in addr field", 5031 condition: `suffix match addr barfoo foobar`, 5032 values: map[string]interface{}{ 5033 "data": "billy", 5034 }, 5035 want: map[string]interface{}{ 5036 "match": false, 5037 }, 5038 }, {name: "failed suffix match an input string against a string condition in addr field", 5039 condition: `suffix match addr foobar`, 5040 values: map[string]interface{}{ 5041 "data": "foobar", 5042 }, 5043 want: map[string]interface{}{ 5044 "match": true, 5045 }, 5046 }, {name: "suffix match an input string against a string condition in addr field", 5047 condition: `suffix match addr foobar`, 5048 values: map[string]interface{}{ 5049 "data": "billy", 5050 }, 5051 want: map[string]interface{}{ 5052 "match": false, 5053 }, 5054 }, {name: "failed regex match an input string against a list of strings in addr field", 5055 condition: `regex match addr barfoo foobar`, 5056 values: map[string]interface{}{ 5057 "data": "foobar", 5058 }, 5059 want: map[string]interface{}{ 5060 "match": true, 5061 }, 5062 }, {name: "regex match an input string against a list of strings in addr field", 5063 condition: `regex match addr barfoo foobar`, 5064 values: map[string]interface{}{ 5065 "data": "billy", 5066 }, 5067 want: map[string]interface{}{ 5068 "match": false, 5069 }, 5070 }, {name: "failed regex match an input string against a string condition in addr field", 5071 condition: `regex match addr foobar`, 5072 values: map[string]interface{}{ 5073 "data": "foobar", 5074 }, 5075 want: map[string]interface{}{ 5076 "match": true, 5077 }, 5078 }, {name: "regex match an input string against a string condition in addr field", 5079 condition: `regex match addr foobar`, 5080 values: map[string]interface{}{ 5081 "data": "billy", 5082 }, 5083 want: map[string]interface{}{ 5084 "match": false, 5085 }, 5086 }, {name: "failed exact match an input string against a list of strings in method field", 5087 condition: `exact match method barfoo foobar`, 5088 values: map[string]interface{}{ 5089 "data": "foobar", 5090 }, 5091 want: map[string]interface{}{ 5092 "match": true, 5093 }, 5094 }, {name: "exact match an input string against a list of strings in method field", 5095 condition: `exact match method barfoo foobar`, 5096 values: map[string]interface{}{ 5097 "data": "billy", 5098 }, 5099 want: map[string]interface{}{ 5100 "match": false, 5101 }, 5102 }, {name: "failed default match an input string against a list of strings in method field", 5103 condition: ` match method barfoo foobar`, 5104 values: map[string]interface{}{ 5105 "data": "foobar", 5106 }, 5107 want: map[string]interface{}{ 5108 "match": true, 5109 }, 5110 }, {name: "default match an input string against a list of strings in method field", 5111 condition: ` match method barfoo foobar`, 5112 values: map[string]interface{}{ 5113 "data": "billy", 5114 }, 5115 want: map[string]interface{}{ 5116 "match": false, 5117 }, 5118 }, {name: "failed exact match an input string against a string condition in method field", 5119 condition: `exact match method foobar`, 5120 values: map[string]interface{}{ 5121 "data": "foobar", 5122 }, 5123 want: map[string]interface{}{ 5124 "match": true, 5125 }, 5126 }, {name: "exact match an input string against a string condition in method field", 5127 condition: `exact match method foobar`, 5128 values: map[string]interface{}{ 5129 "data": "billy", 5130 }, 5131 want: map[string]interface{}{ 5132 "match": false, 5133 }, 5134 }, {name: "failed default match an input string against a string condition in method field", 5135 condition: ` match method foobar`, 5136 values: map[string]interface{}{ 5137 "data": "foobar", 5138 }, 5139 want: map[string]interface{}{ 5140 "match": true, 5141 }, 5142 }, {name: "default match an input string against a string condition in method field", 5143 condition: ` match method foobar`, 5144 values: map[string]interface{}{ 5145 "data": "billy", 5146 }, 5147 want: map[string]interface{}{ 5148 "match": false, 5149 }, 5150 }, {name: "failed partial match an input string against a list of strings in method field", 5151 condition: `partial match method barfoo foobar`, 5152 values: map[string]interface{}{ 5153 "data": "foobar", 5154 }, 5155 want: map[string]interface{}{ 5156 "match": true, 5157 }, 5158 }, {name: "partial match an input string against a list of strings in method field", 5159 condition: `partial match method barfoo foobar`, 5160 values: map[string]interface{}{ 5161 "data": "billy", 5162 }, 5163 want: map[string]interface{}{ 5164 "match": false, 5165 }, 5166 }, {name: "failed partial match an input string against a string condition in method field", 5167 condition: `partial match method foobar`, 5168 values: map[string]interface{}{ 5169 "data": "foobar", 5170 }, 5171 want: map[string]interface{}{ 5172 "match": true, 5173 }, 5174 }, {name: "partial match an input string against a string condition in method field", 5175 condition: `partial match method foobar`, 5176 values: map[string]interface{}{ 5177 "data": "billy", 5178 }, 5179 want: map[string]interface{}{ 5180 "match": false, 5181 }, 5182 }, {name: "failed prefix match an input string against a list of strings in method field", 5183 condition: `prefix match method barfoo foobar`, 5184 values: map[string]interface{}{ 5185 "data": "foobar", 5186 }, 5187 want: map[string]interface{}{ 5188 "match": true, 5189 }, 5190 }, {name: "prefix match an input string against a list of strings in method field", 5191 condition: `prefix match method barfoo foobar`, 5192 values: map[string]interface{}{ 5193 "data": "billy", 5194 }, 5195 want: map[string]interface{}{ 5196 "match": false, 5197 }, 5198 }, {name: "failed prefix match an input string against a string condition in method field", 5199 condition: `prefix match method foobar`, 5200 values: map[string]interface{}{ 5201 "data": "foobar", 5202 }, 5203 want: map[string]interface{}{ 5204 "match": true, 5205 }, 5206 }, {name: "prefix match an input string against a string condition in method field", 5207 condition: `prefix match method foobar`, 5208 values: map[string]interface{}{ 5209 "data": "billy", 5210 }, 5211 want: map[string]interface{}{ 5212 "match": false, 5213 }, 5214 }, {name: "failed suffix match an input string against a list of strings in method field", 5215 condition: `suffix match method barfoo foobar`, 5216 values: map[string]interface{}{ 5217 "data": "foobar", 5218 }, 5219 want: map[string]interface{}{ 5220 "match": true, 5221 }, 5222 }, {name: "suffix match an input string against a list of strings in method field", 5223 condition: `suffix match method barfoo foobar`, 5224 values: map[string]interface{}{ 5225 "data": "billy", 5226 }, 5227 want: map[string]interface{}{ 5228 "match": false, 5229 }, 5230 }, {name: "failed suffix match an input string against a string condition in method field", 5231 condition: `suffix match method foobar`, 5232 values: map[string]interface{}{ 5233 "data": "foobar", 5234 }, 5235 want: map[string]interface{}{ 5236 "match": true, 5237 }, 5238 }, {name: "suffix match an input string against a string condition in method field", 5239 condition: `suffix match method foobar`, 5240 values: map[string]interface{}{ 5241 "data": "billy", 5242 }, 5243 want: map[string]interface{}{ 5244 "match": false, 5245 }, 5246 }, {name: "failed regex match an input string against a list of strings in method field", 5247 condition: `regex match method barfoo foobar`, 5248 values: map[string]interface{}{ 5249 "data": "foobar", 5250 }, 5251 want: map[string]interface{}{ 5252 "match": true, 5253 }, 5254 }, {name: "regex match an input string against a list of strings in method field", 5255 condition: `regex match method barfoo foobar`, 5256 values: map[string]interface{}{ 5257 "data": "billy", 5258 }, 5259 want: map[string]interface{}{ 5260 "match": false, 5261 }, 5262 }, {name: "failed regex match an input string against a string condition in method field", 5263 condition: `regex match method foobar`, 5264 values: map[string]interface{}{ 5265 "data": "foobar", 5266 }, 5267 want: map[string]interface{}{ 5268 "match": true, 5269 }, 5270 }, {name: "regex match an input string against a string condition in method field", 5271 condition: `regex match method foobar`, 5272 values: map[string]interface{}{ 5273 "data": "billy", 5274 }, 5275 want: map[string]interface{}{ 5276 "match": false, 5277 }, 5278 }, {name: "failed exact match an input string against a list of strings in path field", 5279 condition: `exact match path barfoo foobar`, 5280 values: map[string]interface{}{ 5281 "data": "foobar", 5282 }, 5283 want: map[string]interface{}{ 5284 "match": true, 5285 }, 5286 }, {name: "exact match an input string against a list of strings in path field", 5287 condition: `exact match path barfoo foobar`, 5288 values: map[string]interface{}{ 5289 "data": "billy", 5290 }, 5291 want: map[string]interface{}{ 5292 "match": false, 5293 }, 5294 }, {name: "failed default match an input string against a list of strings in path field", 5295 condition: ` match path barfoo foobar`, 5296 values: map[string]interface{}{ 5297 "data": "foobar", 5298 }, 5299 want: map[string]interface{}{ 5300 "match": true, 5301 }, 5302 }, {name: "default match an input string against a list of strings in path field", 5303 condition: ` match path barfoo foobar`, 5304 values: map[string]interface{}{ 5305 "data": "billy", 5306 }, 5307 want: map[string]interface{}{ 5308 "match": false, 5309 }, 5310 }, {name: "failed exact match an input string against a string condition in path field", 5311 condition: `exact match path foobar`, 5312 values: map[string]interface{}{ 5313 "data": "foobar", 5314 }, 5315 want: map[string]interface{}{ 5316 "match": true, 5317 }, 5318 }, {name: "exact match an input string against a string condition in path field", 5319 condition: `exact match path foobar`, 5320 values: map[string]interface{}{ 5321 "data": "billy", 5322 }, 5323 want: map[string]interface{}{ 5324 "match": false, 5325 }, 5326 }, {name: "failed default match an input string against a string condition in path field", 5327 condition: ` match path foobar`, 5328 values: map[string]interface{}{ 5329 "data": "foobar", 5330 }, 5331 want: map[string]interface{}{ 5332 "match": true, 5333 }, 5334 }, {name: "default match an input string against a string condition in path field", 5335 condition: ` match path foobar`, 5336 values: map[string]interface{}{ 5337 "data": "billy", 5338 }, 5339 want: map[string]interface{}{ 5340 "match": false, 5341 }, 5342 }, {name: "failed partial match an input string against a list of strings in path field", 5343 condition: `partial match path barfoo foobar`, 5344 values: map[string]interface{}{ 5345 "data": "foobar", 5346 }, 5347 want: map[string]interface{}{ 5348 "match": true, 5349 }, 5350 }, {name: "partial match an input string against a list of strings in path field", 5351 condition: `partial match path barfoo foobar`, 5352 values: map[string]interface{}{ 5353 "data": "billy", 5354 }, 5355 want: map[string]interface{}{ 5356 "match": false, 5357 }, 5358 }, {name: "failed partial match an input string against a string condition in path field", 5359 condition: `partial match path foobar`, 5360 values: map[string]interface{}{ 5361 "data": "foobar", 5362 }, 5363 want: map[string]interface{}{ 5364 "match": true, 5365 }, 5366 }, {name: "partial match an input string against a string condition in path field", 5367 condition: `partial match path foobar`, 5368 values: map[string]interface{}{ 5369 "data": "billy", 5370 }, 5371 want: map[string]interface{}{ 5372 "match": false, 5373 }, 5374 }, {name: "failed prefix match an input string against a list of strings in path field", 5375 condition: `prefix match path barfoo foobar`, 5376 values: map[string]interface{}{ 5377 "data": "foobar", 5378 }, 5379 want: map[string]interface{}{ 5380 "match": true, 5381 }, 5382 }, {name: "prefix match an input string against a list of strings in path field", 5383 condition: `prefix match path barfoo foobar`, 5384 values: map[string]interface{}{ 5385 "data": "billy", 5386 }, 5387 want: map[string]interface{}{ 5388 "match": false, 5389 }, 5390 }, {name: "failed prefix match an input string against a string condition in path field", 5391 condition: `prefix match path foobar`, 5392 values: map[string]interface{}{ 5393 "data": "foobar", 5394 }, 5395 want: map[string]interface{}{ 5396 "match": true, 5397 }, 5398 }, {name: "prefix match an input string against a string condition in path field", 5399 condition: `prefix match path foobar`, 5400 values: map[string]interface{}{ 5401 "data": "billy", 5402 }, 5403 want: map[string]interface{}{ 5404 "match": false, 5405 }, 5406 }, {name: "failed suffix match an input string against a list of strings in path field", 5407 condition: `suffix match path barfoo foobar`, 5408 values: map[string]interface{}{ 5409 "data": "foobar", 5410 }, 5411 want: map[string]interface{}{ 5412 "match": true, 5413 }, 5414 }, {name: "suffix match an input string against a list of strings in path field", 5415 condition: `suffix match path barfoo foobar`, 5416 values: map[string]interface{}{ 5417 "data": "billy", 5418 }, 5419 want: map[string]interface{}{ 5420 "match": false, 5421 }, 5422 }, {name: "failed suffix match an input string against a string condition in path field", 5423 condition: `suffix match path foobar`, 5424 values: map[string]interface{}{ 5425 "data": "foobar", 5426 }, 5427 want: map[string]interface{}{ 5428 "match": true, 5429 }, 5430 }, {name: "suffix match an input string against a string condition in path field", 5431 condition: `suffix match path foobar`, 5432 values: map[string]interface{}{ 5433 "data": "billy", 5434 }, 5435 want: map[string]interface{}{ 5436 "match": false, 5437 }, 5438 }, {name: "failed regex match an input string against a list of strings in path field", 5439 condition: `regex match path barfoo foobar`, 5440 values: map[string]interface{}{ 5441 "data": "foobar", 5442 }, 5443 want: map[string]interface{}{ 5444 "match": true, 5445 }, 5446 }, {name: "regex match an input string against a list of strings in path field", 5447 condition: `regex match path barfoo foobar`, 5448 values: map[string]interface{}{ 5449 "data": "billy", 5450 }, 5451 want: map[string]interface{}{ 5452 "match": false, 5453 }, 5454 }, {name: "failed regex match an input string against a string condition in path field", 5455 condition: `regex match path foobar`, 5456 values: map[string]interface{}{ 5457 "data": "foobar", 5458 }, 5459 want: map[string]interface{}{ 5460 "match": true, 5461 }, 5462 }, {name: "regex match an input string against a string condition in path field", 5463 condition: `regex match path foobar`, 5464 values: map[string]interface{}{ 5465 "data": "billy", 5466 }, 5467 want: map[string]interface{}{ 5468 "match": false, 5469 }, 5470 }, 5471 } 5472 for _, tc := range testcases { 5473 t.Run(tc.name, func(t *testing.T) { 5474 // t.Logf(tc.name) 5475 // t.Logf(tc.condition) 5476 ctx := context.Background() 5477 var cond aclRuleCondition 5478 parsedACLRuleCondition, err := newACLRuleCondition(ctx, strings.Split(tc.condition, " ")) 5479 if tests.EvalErr(t, err, tc.condition, false, nil) { 5480 return 5481 } 5482 cond = parsedACLRuleCondition 5483 got := make(map[string]interface{}) 5484 got["match"] = cond.match(context.Background(), tc.values["data"]) 5485 // t.Logf("condition: %v", tc.condition) 5486 // t.Logf("values: %v", tc.values) 5487 tests.EvalObjects(t, "match result", tc.want, got) 5488 }) 5489 } 5490 }