[management] Keep embedded IdP deployments on a single account (#7380)

This commit is contained in:
Bethuel Mmbaga
2026-09-04 11:03:54 +03:00
committed by GitHub
parent 13ab50b901
commit 066af82c3e
12 changed files with 623 additions and 19 deletions
+3
View File
@@ -236,6 +236,9 @@ func ApplyEmbeddedIdPConfig(ctx context.Context, cfg *nbconfig.Config) error {
// Embedded IdP requires single account mode - multiple account mode is not supported
return fmt.Errorf("embedded IdP requires single account mode; multiple account mode is not supported with embedded IdP. Please remove --disable-single-account-mode flag")
}
if mgmtSingleAccModeDomain == "" {
return fmt.Errorf("embedded IdP requires single account mode; --single-account-mode-domain must not be empty")
}
// Enable user deletion from IDP by default if EmbeddedIdP is enabled
userDeleteFromIDPEnabled = true
+21 -1
View File
@@ -5,8 +5,12 @@ import (
"os"
"testing"
"github.com/netbirdio/netbird/shared/management/grpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
nbconfig "github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/server/idp"
"github.com/netbirdio/netbird/shared/management/grpc"
)
const (
@@ -60,6 +64,22 @@ func Test_LoadMgmtConfig_Empty(t *testing.T) {
assert.Nil(t, cfg.PerAccountHighestSupportedSyncMessageVersion)
}
func TestApplyEmbeddedIdPConfigRequiresSingleAccountDomain(t *testing.T) {
previousDomain := mgmtSingleAccModeDomain
previousDisabled := disableSingleAccMode
t.Cleanup(func() {
mgmtSingleAccModeDomain = previousDomain
disableSingleAccMode = previousDisabled
})
mgmtSingleAccModeDomain = ""
disableSingleAccMode = false
cfg := &nbconfig.Config{
EmbeddedIdP: &idp.EmbeddedIdPConfig{Enabled: true},
}
require.ErrorContains(t, ApplyEmbeddedIdPConfig(context.Background(), cfg), "embedded IdP requires single account mode")
}
func createConfig(config string) (string, error) {
tmpfile, err := os.CreateTemp("", "config.json")
if err != nil {