SSO-API · Repository map + Bootstrap (branch: master)
sso-api เป็น NestJS 10 microservice แบบ single-module — gateway/adapter ไปยัง SSO ภายนอกของสภากาชาด พร้อม auto-provision username จาก HRMI
สถานะสำคัญ: JWT infrastructure มีครบ แต่ ไม่ออก token จริง — signIn ไม่คืน accessToken ทำให้ endpoint ที่ต้องการ JWT (signOut, verifySession, request2FA, verify2FA) ใช้งานต่อจาก signIn ไม่ได้
Identity
| Item | Value |
|---|---|
| Canonical branch | master (35 tracked files) — default main มีแค่ Initial commit |
| Stack | NestJS 10 + TypeORM 0.3 + MSSQL + Passport JWT |
| Architecture | Single-module monolith — ไม่มี modules/ subtree |
| Package manager | yarn |
| Cron | ไม่มี |
File map
sso-api/
├── src/
│ ├── main.ts bootstrap
│ ├── app.module.ts ConfigModule + JwtModule + TypeOrmModule
│ ├── app.controller.ts 7 endpoints
│ ├── app.service.ts all business logic (~284 lines)
│ ├── dto/ 7 DTO classes
│ └── entities/sso-user.entity.ts
├── libs/
│ ├── jwt/jwt-auth.guard.ts JwtAuthGuard + @Public()
│ ├── jwt/jwt.strategy.ts
│ ├── common/aes-encrypt.ts, aes-decrypt.ts, get-new-username.ts
│ ├── interceptors/post-status.ts
│ ├── exception/http-exception.filter.ts ← EXISTS but NOT wired
│ └── log/logs.middleware.ts
└── config/configuration.tsBootstrap — main.ts
sso-api/src/main.ts:10-35 (branch: master):
NestFactory.create(AppModule)- Global prefix =
{BASE_PATH}{API_VERSION_PATH}(env — UNVERIFIED values) app.useGlobalGuards(new JwtAuthGuard(reflector))— ทุก route ถูก guard- Swagger ที่
{BASE_PATH}docs - Bind
0.0.0.0
สิ่งที่ไม่ได้ wire:
HttpExceptionFilterมีไฟล์แต่ไม่useGlobalFiltersValidationPipeไม่มี —class-validatorบน DTO ไม่ถูก enforce
Module registration
sso-api/src/app.module.ts:11-29:
@Module({
imports: [
ConfigModule.forRoot({ load: [configuration], isGlobal: true }),
JwtModule.register({ /* secret from JWT_SECRET_KEY */ }),
TypeOrmModule.forRootAsync({ name: 'main', /* MSSQL */ }),
],
controllers: [AppController],
providers: [AppService, JwtStrategy],
})Consumer map — ใครเรียก service นี้?
ไม่พบ caller ใน monorepo ที่ชี้ host ของ sso-api โดยตรง
Legacy frontend เรียก {vtrcapi}/SSOService/checkEmpLogin — gateway path บน vtrc-api ไม่ใช่ sso-api
Parallel SSO implementations ที่ยัง active:
cu-central-api/main-api/src/lib/sso/sso.js2way-api/src/modules/auth/auth.service.ts
สรุป: sso-api ดูเหมือน extracted/replacement service ที่ ยังไม่ถูก wire เข้า production callers ตามหลักฐานในโค้ด
ขั้นตอนถัดไป
ไป 02 Auth + endpoints →