Skip to content

Commit 742faec

Browse files
committed
fix: do not mark SAML and Auth0 config sections as mutually exclusive
Auth0 has some configs defined by default, but is disabled. They clash with each other when SAML is enabled. Make the check more fine-grained: only fail if both `Auth0.Enabled` and `SAML.Enabled` are set. Signed-off-by: Artem Chernyshev <[email protected]>
1 parent de86c74 commit 742faec

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

internal/pkg/config/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import (
1515
//nolint:govet
1616
type Auth struct {
1717
// Auth0 auth type configuration.
18-
Auth0 Auth0 `yaml:"auth0" validate:"excluded_with=SAML"`
18+
Auth0 Auth0 `yaml:"auth0" validate:"excluded_if=SAML.Enabled true"`
1919
// WebAuthn auth type configuration.
2020
WebAuthn WebAuthn `yaml:"webauthn"`
2121
// SAML auth type configuration.
22-
SAML SAML `yaml:"saml" validate:"excluded_with=Auth0"`
22+
SAML SAML `yaml:"saml" validate:"excluded_if=Auth0.Enabled true"`
2323

2424
// KeyPruner automatically removes the unused public keys registered in Omni.
2525
KeyPruner KeyPrunerConfig `yaml:"keyPruner"`

internal/pkg/config/testdata/config-full.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ auth:
6060
domain: TODO
6161
initialUsers:
6262
63+
saml:
64+
enabled: false
6365
initialServiceAccount:
6466
enabled: true
6567
role: Admin
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
account:
2-
id: some-id
3-
name: some-name
2+
id: some-id
3+
name: some-name
44

55
services:
66
api:
7-
endpoint: localhost:8080
7+
endpoint: localhost:8080
88
siderolink:
9-
joinTokensMode: strict
9+
joinTokensMode: strict
1010
kubernetesProxy:
1111
endpoint: 0.0.0.0:8095
1212

1313
auth:
1414
keyPruner:
15-
interval: 10m
15+
interval: 10m
1616

1717
logs:
1818
audit:
19-
path: _out/audit
19+
path: _out/audit
2020

2121
storage:
2222
secondary:
23-
path: _out/secondary-storage/bolt.db
23+
path: _out/secondary-storage/bolt.db
2424
default:
25-
kind: etcd
25+
kind: etcd
2626
etcd:
2727
privateKeySource: some-source
2828
registries:
29-
talos: factory.talos.dev
30-
kubernetes: registry.k8s.io
31-
imageFactoryBaseURL: https://factory.talos.dev
29+
talos: factory.talos.dev
30+
kubernetes: registry.k8s.io
31+
imageFactoryBaseURL: https://factory.talos.dev

internal/pkg/config/testdata/conflicting-auth.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
endpoint: 0.0.0.0:8095
1111
certFile: certFile
1212
keyFile: keyFile
13+
siderolink:
14+
joinTokensMode: strict
1315

1416
auth:
1517
keyPruner:

0 commit comments

Comments
 (0)