feat(phase1): add OIDC provider, MongoDB audit, and Docker infrastructure
- Add oidc-provider v9 for OIDC/OAuth2 authentication
- Add MongoDB client service for audit logging (sso_audit database)
- Add audit logger service with retry queue (up to 3 retries, 60s timeout)
- Add audit repository (insert, findByUserId, findByEventType)
- Add OIDC PostgreSQL adapter (grants storage)
- Add Handlebars views (login, register, consent)
- Add OIDC config service (issuer, TTL, cookie keys)
- Add oidc-grants and clients SQL migrations
- Update docker-compose: add PostgreSQL, MongoDB, rename containers
- Update .env.example: add OIDC, MongoDB, PostgreSQL variables
- Update package.json: add oidc-provider, mongodb, express-handlebars
- Update README with OIDC endpoints and architecture diagram
Co-authored-by:
Cursor <cursoragent@cursor.com>
Showing
| { | { | ||
| "name": "bekind-backend", | "name": "sso-vietprodev-backend", | ||
| "version": "1.0.0", | "version": "1.0.0", | ||
| "description": "A Node.js backend template built with TypeScript, Express, and Sequelize, designed for rapid API development with a focus on best practices, security, and scalability.", | "description": "SSO Backend built with TypeScript, Express, and Sequelize — supports OIDC/OAuth2, bcryptjs, PostgreSQL multi-pool, and MongoDB audit logging.", | ||
| "main": "dist/index.js", | "main": "dist/index.js", | ||
| "engines": { | "engines": { | ||
| "node": ">=20.1.0", | "node": ">=20.1.0", | ||
| ... | @@ -80,9 +80,9 @@ | ... | @@ -80,9 +80,9 @@ |
| "test:integration": "cross-env NODE_ENV=test jest tests/integration", | "test:integration": "cross-env NODE_ENV=test jest tests/integration", | ||
| "test:critical": "cross-env NODE_ENV=test jest --testPathPattern=\"(auth|virusScan)\" --no-coverage", | "test:critical": "cross-env NODE_ENV=test jest --testPathPattern=\"(auth|virusScan)\" --no-coverage", | ||
| "-----------------DOCKER------------------": "", | "-----------------DOCKER------------------": "", | ||
| "docker:build": "docker build -t bekind-backend .", | "docker:build": "docker build -t sso-vietprodev-backend .", | ||
| "docker:build:dev": "docker build --target development -t bekind-backend:dev .", | "docker:build:dev": "docker build --target development -t sso-vietprodev-backend:dev .", | ||
| "docker:build:prod": "docker build --target production -t bekind-backend:prod .", | "docker:build:prod": "docker build --target production -t sso-vietprodev-backend:prod .", | ||
| "docker:infra": "docker compose up redis minio -d", | "docker:infra": "docker compose up redis minio -d", | ||
| "docker:infra:down": "docker compose down redis minio", | "docker:infra:down": "docker compose down redis minio", | ||
| "docker:dev": "docker compose --profile dev up --build", | "docker:dev": "docker compose --profile dev up --build", | ||
| ... | @@ -108,7 +108,7 @@ | ... | @@ -108,7 +108,7 @@ |
| "backend", | "backend", | ||
| "rest" | "rest" | ||
| ], | ], | ||
| "author": "Nguyen Thi Nguyet Que", | "author": "VietProDev Team", | ||
| "license": "ISC", | "license": "ISC", | ||
| "dependencies": { | "dependencies": { | ||
| "@asteasolutions/zod-to-openapi": "^8.5.0", | "@asteasolutions/zod-to-openapi": "^8.5.0", | ||
| ... | @@ -123,14 +123,17 @@ | ... | @@ -123,14 +123,17 @@ |
| "dotenv": "^17.2.3", | "dotenv": "^17.2.3", | ||
| "express": "^4.22.1", | "express": "^4.22.1", | ||
| "express-automatic-routes": "^1.1.0", | "express-automatic-routes": "^1.1.0", | ||
| "express-handlebars": "^8.0.1", | |||
| "express-validator": "^7.3.1", | "express-validator": "^7.3.1", | ||
| "file-type": "^19.6.0", | "file-type": "^19.6.0", | ||
| "handlebars": "^4.7.9", | "handlebars": "^4.7.9", | ||
| "helmet": "^8.1.0", | "helmet": "^8.1.0", | ||
| "ioredis": "^5.4.1", | "ioredis": "^5.4.1", | ||
| "jsonwebtoken": "^9.0.3", | "jsonwebtoken": "^9.0.3", | ||
| "mongodb": "^6.16.0", | |||
| "module-alias": "^2.2.3", | "module-alias": "^2.2.3", | ||
| "multer": "^2.0.2", | "multer": "^2.0.2", | ||
| "oidc-provider": "^9.8.4", | |||
| "mustache": "^4.2.0", | "mustache": "^4.2.0", | ||
| "mv": "^2.1.1", | "mv": "^2.1.1", | ||
| "node-schedule": "^2.1.1", | "node-schedule": "^2.1.1", | ||
| ... | @@ -164,6 +167,7 @@ | ... | @@ -164,6 +167,7 @@ |
| "@types/cookie-parser": "^1.4.10", | "@types/cookie-parser": "^1.4.10", | ||
| "@types/cors": "^2.8.19", | "@types/cors": "^2.8.19", | ||
| "@types/express": "^5.0.6", | "@types/express": "^5.0.6", | ||
| "@types/express-handlebars": "^3.1.0", | |||
| "@types/ioredis": "^5.0.0", | "@types/ioredis": "^5.0.0", | ||
| "@types/jest": "^29.5.12", | "@types/jest": "^29.5.12", | ||
| "@types/jsonwebtoken": "^9.0.10", | "@types/jsonwebtoken": "^9.0.10", | ||
| ... | ... |
This diff is collapsed.
src/audit/auditEvents.ts
0 → 100644
src/audit/auditRepository.ts
0 → 100644
src/audit/index.ts
0 → 100644
src/audit/schemas/index.ts
0 → 100644
src/database/mongo/index.ts
0 → 100644
src/oidc/views/consent.hbs
0 → 100644
src/oidc/views/login.hbs
0 → 100644
src/oidc/views/register.hbs
0 → 100644
Please register or sign in to comment