ums

IdpConfiguration — Aggregate Architecture

Bounded Context: Configuration
Aggregate Root: IdpConfiguration
Module: Ums.Domain.Configuration.IdpConfiguration
Status: Production


1. Aggregate Overview

Purpose

The IdpConfiguration aggregate stores a tenant and suite-specific identity-provider resolution rule. It encapsulates provider type, domain hints, external configuration payload, secret reference, activation state, fallback chaining, resolution priority, and versioning.

Business Responsibility

Aggregate Root

IdpConfiguration is the aggregate root. Secret references, payload changes, domain hints, and lifecycle transitions are coordinated through it.

Invariants and Consistency Rules

  1. TenantId, SystemSuiteId, and ProviderType are mandatory.
  2. ConfigPayload must be non-empty.
  3. New configurations start in Draft.
  4. Only Draft and Inactive configurations may be updated.
  5. Activating an already active configuration is invalid.
  6. Deactivation is only valid from Active.
  7. Every update increments the numeric Version.

| Entity / VO | Type | Ownership | |—|—|—| | IdpConfigurationId | Value Object | Aggregate identifier | | TenantId | Value Object | Tenant ownership boundary | | SystemSuiteId | Value Object | Suite ownership boundary | | ProviderType | Enumeration | Provider classification | | IdpConfigStatus | Enumeration | Draft, Active, Inactive |

Domain Events

| Event | Trigger | |—|—| | IdpConfigRegisteredEvent | New configuration created | | IdpConfigActivatedEvent | Configuration activated | | IdpConfigDeactivatedEvent | Configuration deactivated | | IdpConfigUpdatedEvent | Mutable configuration updated |


2. Domain Model

IdpConfiguration (Aggregate Root)
└── Props: IdpConfigurationProps
    ├── Id: IdValueObject
    ├── TenantId: TenantId
    ├── SystemSuiteId: SystemSuiteId
    ├── ProviderType: ProviderType
    ├── DomainHints: string[]
    ├── ConfigPayload: string
    ├── SecretRef: string
    ├── Status: IdpConfigStatus
    ├── ResolutionPriority: int
    ├── FallbackToId?: Guid
    ├── Version: int
    └── Audit: AuditValueObject

3. Object Model Diagrams

classDiagram
    class IdpConfiguration {
        +Guid Id
        +Guid TenantId
        +Guid SystemSuiteId
        +ProviderType ProviderType
        +string[] DomainHints
        +string ConfigPayload
        +string SecretRef
        +IdpConfigStatus Status
        +int ResolutionPriority
        +Guid FallbackToId
        +int Version
        +Create(tenantId, systemSuiteId, providerType, domainHints, configPayload, secretRef, resolutionPriority, fallbackToId, actor)
        +Update(configPayload, secretRef, domainHints, actor)
        +Activate(actor)
        +Deactivate(actor)
    }

4. Sequence Diagrams

Update IdP Configuration Flow

sequenceDiagram
    participant C as Client
    participant H as Handler
    participant R as IIdpConfigurationRepository
    participant I as IdpConfiguration (AR)

    C->>H: UpdateIdpConfiguration(id, payload, secretRef, domainHints)
    H->>R: GetById(id)
    R-->>H: IdpConfiguration
    H->>I: Update(payload, secretRef, domainHints, actor)
    I->>I: Validate mutable status and payload
    I->>I: Increment Version
    I->>I: Raise IdpConfigUpdatedEvent
    H->>R: Update(configuration)

5. ER Model

erDiagram
    TENANT ||--o{ IDP_CONFIGURATION : "owns"
    SYSTEM_SUITE ||--o{ IDP_CONFIGURATION : "scopes"

    IDP_CONFIGURATION {
        uniqueidentifier Id PK
        uniqueidentifier TenantId FK
        uniqueidentifier SystemSuiteId FK
        int ProviderTypeId
        nvarchar DomainHintsJson
        nvarchar ConfigPayload
        nvarchar SecretRef
        int StatusId
        int ResolutionPriority
        uniqueidentifier FallbackToId
        int Version
        nvarchar CreatedBy
        datetime2 CreatedAtUtc
        nvarchar UpdatedBy
        datetime2 UpdatedAtUtc
        nvarchar AuditTimeSpan
    }

Tenant Isolation Rules


6. Bounded Context Integration


7. Application Layer


8. Infrastructure/Persistence


9. Security & Compliance


10. Technical Decisions


Back to Configuration Index