New SSO feature with complete authentication system: - Email/password authentication with session management - Multi-factor authentication (MFA) with TOTP support - User registration and login flows - Session handling with secure cookies - Handlebars UI templates for auth flows - Email client integration for notifications Includes comprehensive test coverage for auth, MFA, sessions, and users. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Dockerfile | ||
| nest-cli.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
SSO Service
Single Sign-On authentication service for lilith-platform.
Features
- Session-based authentication with HTTP-only cookies
- Redis session storage
- Login and register endpoints
- Session validation for apps
- Handlebars UI templates
Endpoints
Authentication API
POST /auth/login- Login with email/passwordPOST /auth/register- Register new userGET /auth/validate- Validate session cookieGET /auth/me- Get current userPOST /auth/refresh- Refresh sessionPOST /auth/logout- Logout and clear session
UI Pages
GET /login- Login pageGET /register- Register page
Setup
-
Copy
.env.exampleto.env:cp .env.example .env -
Install dependencies:
pnpm install -
Start Redis (required):
docker-compose up redis -
Start development server:
pnpm start:dev -
Access:
- Service: http://localhost:4001
- Login: http://localhost:4001/login
- Register: http://localhost:4001/register
Environment Variables
See .env.example for required configuration.
Integration
Apps integrate by:
- Redirecting to
/loginor/register(in popup or iframe) - Receiving
AUTH_SUCCESSpostMessage on completion - Making requests with
credentials: 'include'to include cookies - Validating sessions via
GET /auth/validate
Docker
Build:
docker build -t lilith-sso .
Run:
docker run -p 4001:4001 --env-file .env lilith-sso