@@ -238,11 +238,10 @@ type tenant struct {
238238 IssuerRawCA []byte `json:"issuerCA"`
239239 IssuerCAPath string `json:"issuerCAPath"`
240240 issuerCA * x509.Certificate
241- IssuerURL string `json:"issuerURL"`
242- RedirectURL string `json:"redirectURL"`
243- UsernameClaim string `json:"usernameClaim"`
244- Paths []string `json:"paths"`
245- pathMatchers []* regexp.Regexp
241+ IssuerURL string `json:"issuerURL"`
242+ RedirectURL string `json:"redirectURL"`
243+ UsernameClaim string `json:"usernameClaim"`
244+ Paths []authentication.PathPattern `json:"paths"`
246245 config map [string ]interface {}
247246 } `json:"oidc"`
248247 OpenShift * struct {
@@ -258,12 +257,11 @@ type tenant struct {
258257 } `json:"authenticator"`
259258
260259 MTLS * struct {
261- RawCA []byte `json:"ca"`
262- CAPath string `json:"caPath"`
263- Paths []string `json:"paths"`
264- cas []* x509.Certificate
265- pathMatchers []* regexp.Regexp
266- config map [string ]interface {}
260+ RawCA []byte `json:"ca"`
261+ CAPath string `json:"caPath"`
262+ Paths []authentication.PathPattern `json:"paths"`
263+ cas []* x509.Certificate
264+ config map [string ]interface {}
267265 } `json:"mTLS"`
268266 OPA * struct {
269267 Query string `json:"query"`
@@ -368,23 +366,8 @@ func main() {
368366 continue
369367 }
370368
371- // Compile OIDC path matchers
372- for _ , pathPattern := range t .OIDC .Paths {
373- matcher , err := regexp .Compile (pathPattern )
374- if err != nil {
375- skip .Log ("msg" , "failed to compile OIDC path pattern" , "pattern" , pathPattern , "err" , err , "tenant" , t .Name )
376- skippedTenants .WithLabelValues (t .Name ).Inc ()
377- tenantsCfg .Tenants [i ] = nil
378- break
379- }
380- t .OIDC .pathMatchers = append (t .OIDC .pathMatchers , matcher )
381- }
382- if tenantsCfg .Tenants [i ] == nil {
383- continue
384- }
385-
386369 // Add path patterns to the config that will be passed to the authenticator
387- oidcConfig ["pathPatterns " ] = t .OIDC .Paths
370+ oidcConfig ["paths " ] = t .OIDC .Paths
388371 t .OIDC .config = oidcConfig
389372 }
390373
@@ -397,23 +380,8 @@ func main() {
397380 continue
398381 }
399382
400- // Compile mTLS path matchers
401- for _ , pathPattern := range t .MTLS .Paths {
402- matcher , err := regexp .Compile (pathPattern )
403- if err != nil {
404- skip .Log ("msg" , "failed to compile mTLS path pattern" , "pattern" , pathPattern , "err" , err , "tenant" , t .Name )
405- skippedTenants .WithLabelValues (t .Name ).Inc ()
406- tenantsCfg .Tenants [i ] = nil
407- break
408- }
409- t .MTLS .pathMatchers = append (t .MTLS .pathMatchers , matcher )
410- }
411- if tenantsCfg .Tenants [i ] == nil {
412- continue
413- }
414-
415383 // Add path patterns to the config that will be passed to the authenticator
416- mTLSConfig ["pathPatterns " ] = t .MTLS .Paths
384+ mTLSConfig ["paths " ] = t .MTLS .Paths
417385 t .MTLS .config = mTLSConfig
418386 }
419387
@@ -1605,7 +1573,6 @@ func tenantAuthenticatorConfig(t *tenant) (map[string]interface{}, string, error
16051573 }
16061574}
16071575
1608-
16091576type otelErrorHandler struct {
16101577 logger log.Logger
16111578}
0 commit comments