diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index ab39a986..58000329 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -3,6 +3,7 @@ package main import ( "baron-sso-backend/internal/domain" "baron-sso-backend/internal/handler" + "baron-sso-backend/internal/idp" "baron-sso-backend/internal/logger" "baron-sso-backend/internal/repository" "baron-sso-backend/internal/service" @@ -73,14 +74,12 @@ func main() { ) // --- Fail-Fast Schema Validation --- - // Initialize the IDP Provider (Descope) - descopeProjectID := getEnv("DESCOPE_PROJECT_ID", "") - descopeManagementKey := getEnv("DESCOPE_MANAGEMENT_KEY", "") - - // We create a provider instance to check schema compatibility. - // This ensures that our BrokerUser model requirements (e.g. custom attributes) - // are supported by the configured IDP. - idpProvider := service.NewDescopeProvider(descopeProjectID, descopeManagementKey) + // 팩토리를 사용하여 IDP 공급자를 초기화합니다. + idpProvider, err := idp.InitializeProvider() + if err != nil { + slog.Error("❌ [CRITICAL] Failed to initialize IDP Provider", "error", err) + os.Exit(1) + } if err := validator.ValidateIDPCompatibility(domain.BrokerUser{}, idpProvider); err != nil { slog.Error("❌ [CRITICAL] Broker Schema Mismatch",