feat(auth): add POST /login with Playwright automation and SQLite session storage
- automates file-key login on the ID portal using Playwright/Chromium - captures token, cookies, and localStorage after successful redirect - stores session data in SQLite via TypeORM (better-sqlite3) - sessions are keyed by sessionName (auto-generated UUID if not provided) - login URL, cabinet redirect URL, keys dir, and DB path are all configurable via env
This commit is contained in:
+14
-1
@@ -1,6 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { HealthController } from './health/health.controller';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { SessionEntity } from './session/session.entity';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -8,6 +11,16 @@ import { HealthController } from './health/health.controller';
|
||||
isGlobal: true,
|
||||
envFilePath: '.env',
|
||||
}),
|
||||
TypeOrmModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
type: 'better-sqlite3',
|
||||
database: config.get<string>('DB_PATH', 'data/sessions.db'),
|
||||
entities: [SessionEntity],
|
||||
synchronize: true,
|
||||
}),
|
||||
}),
|
||||
AuthModule,
|
||||
],
|
||||
controllers: [HealthController],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user