You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add auth system with multi-tenant isolation and RBAC
Implement a complete authentication and authorization system:
- Pluggable auth provider interface (noop, local) via AUTH_PROVIDER env var
- Noop provider: default for self-hosted, auto-creates org/user, no login required
- Local provider: email/password with bcrypt + JWT (HMAC-SHA256) tokens
- Organization, User, Invite models with multi-tenant data isolation
- Auth middleware injects claims into request context for all routes
- OrgScope GORM scope applied to all handlers for tenant isolation
- Role-based access control (admin/member) with IsAdmin helper
- Admin password reset with crypto/rand temporary passwords
- Invite system with SHA-256 hashed tokens + AES-256-GCM encrypted storage
- Email validation and duplicate checking on invite creation
- WebSocket auth via ?token= query parameter
- Composite unique indexes (Team.Name, Settings.Key) scoped by org_id
- LoadSettingsEnv scoped by org_id to prevent cross-tenant secret leakage
- JWT_SECRET minimum 32 characters validation
- Email case normalization across all auth flows
- Multi-tenant mode with registration gating (MULTI_TENANT env var)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments