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