A high-performance, production-ready Authentication and Authorization Service built with Go, PostgreSQL. AuthSphere provides robust JWT-based authentication featuring stateless short-lived Access Tokens, secure HttpOnly cookie-based Refresh Tokens, blacklisting/revocation support, and role-based protected routes.
- User Onboarding & Management: User registration with hashed password storage (Bcrypt), login, and logout.
- Dual-Token Architecture:
- Access Token: Short-lived JWT (e.g., 15 mins) passed via
Authorization: Bearer <token>header. - Refresh Token: Long-lived token (e.g., 7 days) stored in a secure
HttpOnly,SameSite=Strict,Securecookie.
- Access Token: Short-lived JWT (e.g., 15 mins) passed via
- Token Invalidation & Logout: Revokes refresh tokens and blacklists active sessions using Redis.
- Protected Routes: Middleware enforcement for authenticated users and RBAC (Role-Based Access Control).
- Security Best Practices:
- OWASP compliant password hashing.
- Rate limiting on public auth endpoints.
- CORS and CSRF protections.
- Developer-Friendly: Hot-reloading setup via Air, clean architecture, and full Docker Compose support.