# kili69/t1jit architecture

> Architecture diagram of the GitHub repository kili69/t1jit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kili69/t1jit
- Repository: https://github.com/kili69/t1jit

## Overview

T1JIT provides temporary local-administrator access on Active Directory member servers. The web workflow authenticates a user, presents delegated servers and duration limits, and submits a request for logging; documented downstream processing validates delegation and assigns a TTL-bound AD group membership. Group Policy maps that group to local Administrators, and AD expires the membership. KjitWeb also exposes active elevations and service diagnostics; the shared core loads and validates JIT configuration. Some downstream processing and provisioning are documented but not represented by sampled runtime source.

Main entry points: [`src/C#/Kjitweb/Controllers/HomeController.cs`](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Controllers/HomeController.cs) (Web workflow), [`src/C#/KjitCore/KjitCore.cs`](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/KjitCore.cs) (Shared core facade), [`src/C#/Kjitweb/Program.cs`](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Program.cs) (KjitWeb host), [`src/C#/Kjitweb/Services/ActiveDirectoryService.cs`](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/ActiveDirectoryService.cs) (AD discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web access"]
  node_host["KjitWeb host<br/>[Program.cs]"]
  node_auth["Authentication"]
  node_controller["Web workflow<br/>[HomeController.cs]"]
  node_selection["Request and elevation view"]
end

subgraph group_directory["Directory and configuration"]
  node_ad["AD discovery"]
  node_configpath["Config path resolution"]
  node_core["Shared core facade<br/>[KjitCore.cs]"]
  node_configreader["JIT configuration loading"]
  node_config["JIT configuration model"]
  node_identity["Identity normalization"]
  node_dn["Distinguished-name parsing"]
end

subgraph group_assignment["Privilege assignment"]
  node_gmsa["Scheduled gMSA processor"]
  node_ttlgroup[("Server admin group")]
  node_gpo["Group Policy"]
  node_localadmin[("Local Administrators")]
  node_adttl["AD TTL expiry"]
end

subgraph group_operations["Audit and diagnostics"]
  node_eventlog[("Windows Event Log<br/>[EventLogWriter.cs]")]
  node_health["Event log health"]
  node_audit["Connection audit"]
  node_debuglog["Debug file logging"]
end

node_user(("Administrator requester"))
node_powershell(("PowerShell client"))

node_user -->|"uses web"| node_host
node_powershell -.->|"submits request"| node_gmsa
node_host -->|"registers"| node_auth
node_host -.->|"routes requests"| node_controller
node_controller -->|"queries directory"| node_ad
node_controller -->|"populates view"| node_selection
node_controller -->|"writes request"| node_eventlog
node_ad -->|"resolves config"| node_configpath
node_core -->|"loads config"| node_configreader
node_configreader -->|"creates model"| node_config
node_core -->|"exposes service"| node_identity
node_core -->|"exposes service"| node_dn
node_gmsa -.->|"adds TTL membership"| node_ttlgroup
node_ttlgroup -.->|"is mapped by"| node_gpo
node_gpo -.->|"grants membership"| node_localadmin
node_adttl -.->|"removes expired membership"| node_ttlgroup
node_health -->|"checks health"| node_eventlog
node_audit -->|"writes audit"| node_debuglog

click node_host "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Program.cs"
click node_auth "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/BasicAuthenticationHandler.cs"
click node_controller "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Controllers/HomeController.cs"
click node_selection "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Models/ServerSelectionViewModel.cs"
click node_ad "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/ActiveDirectoryService.cs"
click node_configpath "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/JitConfigPathResolver.cs"
click node_core "https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/KjitCore.cs"
click node_configreader "https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/JitConfigurationReader.cs"
click node_config "https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Models/JitConfigurationObject.cs"
click node_identity "https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/IdentityNormalizer.cs"
click node_dn "https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/DistinguishedNameService.cs"
click node_eventlog "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/EventLogWriter.cs"
click node_health "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/EventLogHealthMonitor.cs"
click node_audit "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/ConnectionAuditLogger.cs"
click node_debuglog "https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/DebugLogFileWriter.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host,node_auth,node_controller,node_selection,node_powershell toneBlue
class node_ad,node_configpath,node_core,node_configreader,node_config,node_identity,node_dn toneAmber
class node_gmsa,node_ttlgroup,node_gpo,node_localadmin,node_adttl,node_user toneMint
class node_eventlog,node_health,node_audit,node_debuglog toneRose
```

## Components

### Web access

- [KjitWeb host](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Program.cs): `src/C#/Kjitweb/Program.cs`
- [Authentication](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/BasicAuthenticationHandler.cs): `src/C#/Kjitweb/Services/BasicAuthenticationHandler.cs`
- [Web workflow](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Controllers/HomeController.cs): `src/C#/Kjitweb/Controllers/HomeController.cs`
- [Request and elevation view](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Models/ServerSelectionViewModel.cs): `src/C#/Kjitweb/Models/ServerSelectionViewModel.cs`

### Directory and configuration

- [AD discovery](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/ActiveDirectoryService.cs): `src/C#/Kjitweb/Services/ActiveDirectoryService.cs`
- [Config path resolution](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/JitConfigPathResolver.cs): `src/C#/Kjitweb/Services/JitConfigPathResolver.cs`
- [Shared core facade](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/KjitCore.cs): `src/C#/KjitCore/KjitCore.cs`
- [JIT configuration loading](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/JitConfigurationReader.cs): `src/C#/KjitCore/Services/JitConfigurationReader.cs`
- [JIT configuration model](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Models/JitConfigurationObject.cs): `src/C#/KjitCore/Models/JitConfigurationObject.cs`
- [Identity normalization](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/IdentityNormalizer.cs): `src/C#/KjitCore/Services/IdentityNormalizer.cs`
- [Distinguished-name parsing](https://github.com/kili69/t1jit/blob/main/src/C%23/KjitCore/Services/DistinguishedNameService.cs): `src/C#/KjitCore/Services/DistinguishedNameService.cs`

### Privilege assignment

- **Scheduled gMSA processor**
- **Server admin group**
- **Group Policy**
- **Local Administrators**
- **AD TTL expiry**

### Audit and diagnostics

- [Windows Event Log](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/EventLogWriter.cs): `src/C#/Kjitweb/Services/EventLogWriter.cs`
- [Event log health](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/EventLogHealthMonitor.cs): `src/C#/Kjitweb/Services/EventLogHealthMonitor.cs`
- [Connection audit](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/ConnectionAuditLogger.cs): `src/C#/Kjitweb/Services/ConnectionAuditLogger.cs`
- [Debug file logging](https://github.com/kili69/t1jit/blob/main/src/C%23/Kjitweb/Services/DebugLogFileWriter.cs): `src/C#/Kjitweb/Services/DebugLogFileWriter.cs`

### Other components

- **Administrator requester**
- **PowerShell client**

## Connections

- Administrator requester → KjitWeb host: uses web
- PowerShell client → Scheduled gMSA processor: submits request
- KjitWeb host → Authentication: registers (evidence: `src/C#/Kjitweb/Program.cs`)
- KjitWeb host → Web workflow: routes requests
- Web workflow → AD discovery: queries directory (evidence: `src/C#/Kjitweb/Controllers/HomeController.cs`)
- Web workflow → Request and elevation view: populates view (evidence: `src/C#/Kjitweb/Controllers/HomeController.cs`)
- Web workflow → Windows Event Log: writes request (evidence: `src/C#/Kjitweb/Controllers/HomeController.cs`)
- AD discovery → Config path resolution: resolves config (evidence: `src/C#/Kjitweb/Services/ActiveDirectoryService.cs`)
- Shared core facade → JIT configuration loading: loads config (evidence: `src/C#/KjitCore/KjitCore.cs`)
- JIT configuration loading → JIT configuration model: creates model (evidence: `src/C#/KjitCore/Services/JitConfigurationReader.cs`)
- Shared core facade → Identity normalization: exposes service (evidence: `src/C#/KjitCore/KjitCore.cs`)
- Shared core facade → Distinguished-name parsing: exposes service (evidence: `src/C#/KjitCore/KjitCore.cs`)
- Scheduled gMSA processor → Server admin group: adds TTL membership
- Server admin group → Group Policy: is mapped by
- Group Policy → Local Administrators: grants membership
- AD TTL expiry → Server admin group: removes expired membership
- Event log health → Windows Event Log: checks health (evidence: `src/C#/Kjitweb/Services/EventLogHealthMonitor.cs`)
- Connection audit → Debug file logging: writes audit (evidence: `src/C#/Kjitweb/Services/ConnectionAuditLogger.cs`)
