# lycevm-3alabang/it_elective_sso_bsit_31a2 architecture

> Architecture diagram of the GitHub repository lycevm-3alabang/it_elective_sso_bsit_31a2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lycevm-3alabang/it_elective_sso_bsit_31a2
- Repository: https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2

## Overview

This is an ASP.NET Core single-sign-on portal: a client app requests login, the service validates its registered return URL, verifies the user, issues a token, and redirects the client with that token. Admin workflows manage users, tenant apps, groups and memberships, and inspect audit logs. Persistence is through EF Core/SQLite with ASP.NET Identity. The README provides no further capability detail; unsampled controller/service behavior is represented only where the source index identifies dependencies, so some relationships are omitted.

Main entry points: [`Data/SsoDbContext.cs`](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Data/SsoDbContext.cs) (EF data context), [`Gateway/Controllers/AuthController.cs`](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Controllers/AuthController.cs) (Login flow), [`Gateway/Services/ReturnUrlValidator.cs`](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/ReturnUrlValidator.cs) (Return URL check), [`Gateway/Services/AuditService.cs`](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/AuditService.cs) (Audit service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_authflow["Login flow<br/>[AuthController.cs]"]
  node_returncheck["Return URL check"]
  node_token["JWT token service"]
  node_identity["Identity accounts<br/>[ApplicationUser.cs]"]
end

subgraph group_admin["Administration"]
  node_useradmin["User management<br/>[UserController.cs]"]
  node_tenantadmin["Tenant app management"]
  node_groupadmin["Group management"]
  node_membership["Group assignment"]
  node_auditadmin["Audit log browsing"]
end

subgraph group_domain["Domain and persistence"]
  node_entities["SSO entities"]
  node_dbcontext["EF data context<br/>[SsoDbContext.cs]"]
  node_mapping["Entity mappings"]
  node_seed["Admin seeding<br/>[SeedData.cs]"]
  node_database[("SQLite database<br/>[sso_bsit31a2.db]")]
end

subgraph group_audit["Audit"]
  node_auditservice["Audit service<br/>[AuditService.cs]"]
  node_auditrecords["Audit records<br/>[AuditLog.cs]"]
end

node_client(("Client app"))

node_client -->|"requests login"| node_authflow
node_authflow -->|"validates return URL"| node_returncheck
node_authflow -->|"checks credentials"| node_identity
node_authflow -->|"creates token"| node_token
node_authflow -->|"logs login"| node_auditservice
node_returncheck -->|"looks up app"| node_dbcontext
node_returncheck -->|"records validation"| node_auditrecords
node_useradmin -->|"manages accounts"| node_identity
node_useradmin -->|"writes audit entry"| node_dbcontext
node_tenantadmin -->|"manages apps"| node_dbcontext
node_groupadmin -->|"manages groups"| node_dbcontext
node_membership -->|"manages assignments"| node_dbcontext
node_auditadmin -->|"reads audit logs"| node_dbcontext
node_auditservice -->|"saves audit logs"| node_dbcontext
node_dbcontext -->|"applies mappings"| node_mapping
node_dbcontext -->|"maps entities"| node_entities
node_dbcontext -.->|"persists data"| node_database
node_seed -->|"creates admin"| node_identity
node_auditservice -->|"creates records"| node_auditrecords
node_authflow -->|"redirects with token"| node_client

click node_authflow "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Controllers/AuthController.cs"
click node_returncheck "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/ReturnUrlValidator.cs"
click node_token "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/IJwtTokenService.cs"
click node_identity "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Models/ApplicationUser.cs"
click node_useradmin "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/UserController.cs"
click node_tenantadmin "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/TenantAppsController.cs"
click node_groupadmin "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/GroupsController.cs"
click node_membership "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/UserGroupsController.cs"
click node_auditadmin "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/AuditLogsController.cs"
click node_entities "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/tree/main/Models"
click node_dbcontext "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Data/SsoDbContext.cs"
click node_mapping "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/tree/main/Data/Configurations"
click node_seed "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Data/SeedData.cs"
click node_database "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/sso_bsit31a2.db"
click node_auditservice "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/AuditService.cs"
click node_auditrecords "https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Models/AuditLog.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_authflow,node_returncheck,node_token,node_identity,node_client toneBlue
class node_useradmin,node_tenantadmin,node_groupadmin,node_membership,node_auditadmin toneAmber
class node_entities,node_dbcontext,node_mapping,node_seed,node_database toneMint
class node_auditservice,node_auditrecords toneRose
```

## Components

### Authentication

- [Login flow](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Controllers/AuthController.cs): `Gateway/Controllers/AuthController.cs`
- [Return URL check](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/ReturnUrlValidator.cs): `Gateway/Services/ReturnUrlValidator.cs`
- [JWT token service](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/IJwtTokenService.cs): `Gateway/Services/IJwtTokenService.cs`
- [Identity accounts](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Models/ApplicationUser.cs): `Models/ApplicationUser.cs`

### Administration

- [User management](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/UserController.cs): `Gateway/Areas/Admin/Controllers/UserController.cs`
- [Tenant app management](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/TenantAppsController.cs): `Gateway/Areas/Admin/Controllers/TenantAppsController.cs`
- [Group management](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/GroupsController.cs): `Gateway/Areas/Admin/Controllers/GroupsController.cs`
- [Group assignment](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/UserGroupsController.cs): `Gateway/Areas/Admin/Controllers/UserGroupsController.cs`
- [Audit log browsing](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Areas/Admin/Controllers/AuditLogsController.cs): `Gateway/Areas/Admin/Controllers/AuditLogsController.cs`

### Domain and persistence

- [SSO entities](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/tree/main/Models): `Models`
- [EF data context](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Data/SsoDbContext.cs): `Data/SsoDbContext.cs`
- [Entity mappings](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/tree/main/Data/Configurations): `Data/Configurations`
- [Admin seeding](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Data/SeedData.cs): `Data/SeedData.cs`
- [SQLite database](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/sso_bsit31a2.db): `Gateway/sso_bsit31a2.db`

### Audit

- [Audit service](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Gateway/Services/AuditService.cs): `Gateway/Services/AuditService.cs`
- [Audit records](https://github.com/lycevm-3alabang/it_elective_sso_bsit_31a2/blob/main/Models/AuditLog.cs): `Models/AuditLog.cs`

### Other components

- **Client app**

## Connections

- Client app → Login flow: requests login (evidence: `Gateway/Controllers/AuthController.cs`)
- Login flow → Return URL check: validates return URL (evidence: `Gateway/Controllers/AuthController.cs`)
- Login flow → Identity accounts: checks credentials (evidence: `Gateway/Controllers/AuthController.cs`)
- Login flow → JWT token service: creates token (evidence: `Gateway/Controllers/AuthController.cs`)
- Login flow → Audit service: logs login (evidence: `Gateway/Controllers/AuthController.cs`)
- Return URL check → EF data context: looks up app (evidence: `Gateway/Services/ReturnUrlValidator.cs`)
- Return URL check → Audit records: records validation (evidence: `Gateway/Services/ReturnUrlValidator.cs`)
- User management → Identity accounts: manages accounts (evidence: `Gateway/Areas/Admin/Controllers/UserController.cs`)
- User management → EF data context: writes audit entry (evidence: `Gateway/Areas/Admin/Controllers/UserController.cs`)
- Tenant app management → EF data context: manages apps (evidence: `Gateway/Areas/Admin/Controllers/TenantAppsController.cs`)
- Group management → EF data context: manages groups (evidence: `Gateway/Areas/Admin/Controllers/GroupsController.cs`)
- Group assignment → EF data context: manages assignments (evidence: `Gateway/Areas/Admin/Controllers/UserGroupsController.cs`)
- Audit log browsing → EF data context: reads audit logs (evidence: `Gateway/Areas/Admin/Controllers/AuditLogsController.cs`)
- Audit service → EF data context: saves audit logs (evidence: `Gateway/Services/AuditService.cs`)
- EF data context → Entity mappings: applies mappings (evidence: `Data/SsoDbContext.cs`)
- EF data context → SSO entities: maps entities (evidence: `Data/SsoDbContext.cs`)
- EF data context → SQLite database: persists data
- Admin seeding → Identity accounts: creates admin (evidence: `Data/SeedData.cs`)
- Audit service → Audit records: creates records (evidence: `Gateway/Services/AuditService.cs`)
- Login flow → Client app: redirects with token (evidence: `Gateway/Controllers/AuthController.cs`)
