Its been a while
CI / scan_ruby (push) Failing after 2m13s
CI / lint (push) Failing after 20s

This commit is contained in:
Jason Jordan
2026-07-23 10:41:46 -04:00
parent 16fadfd529
commit 9853d58469
83 changed files with 1978 additions and 243 deletions
+8 -8
View File
@@ -115,7 +115,7 @@ POST /api/v1/logout
Authorization: Bearer <your_access_token>
```
blacklists the current token (real logout, token becomes invalid)
retires the current token (real logout, token becomes invalid)
## 👥 role-based authorization
@@ -146,7 +146,7 @@ end
## 🔒 security features
* **no secret fallbacks**: JWT_SECRET_KEY must be set (crashes if missing)
* **token blacklisting**: logout actually invalidates tokens
* **token retireing**: logout actually invalidates tokens
* **refresh tokens**: short-lived access tokens (1 hour) + long-lived refresh tokens (7 days)
* **rate limiting**: login, signup, and refresh endpoints are throttled
* **JTI tracking**: every token has a unique identifier for precise control
@@ -176,8 +176,8 @@ rspec
add these to your scheduled jobs (sidekiq, cron, etc):
```ruby
# clean up expired blacklisted tokens
BlacklistedToken.cleanup_expired
# clean up expired retired tokens
RetiredToken.cleanup_expired
# clean up old refresh tokens
RefreshToken.cleanup_old_tokens
@@ -196,8 +196,8 @@ REDIS_URL=your_redis_url (optional, for rack-attack)
### database indexes
migrations include proper indexes for performance:
* `blacklisted_tokens.jti` (unique)
* `blacklisted_tokens.exp`
* `retired_tokens.jti` (unique)
* `retired_tokens.exp`
* `refresh_tokens.token` (unique)
* `refresh_tokens.user_id + revoked`
* `users.role`
@@ -210,7 +210,7 @@ open issues or pull requests.
## ✨ features
* ✅ JWT authentication with secure token generation (includes JTI for tracking)
* ✅ Token blacklisting for real logout (tokens are invalidated on logout)
* ✅ Token retireing for real logout (tokens are invalidated on logout)
* ✅ Refresh tokens (7-day expiry, keeps users logged in securely)
* ✅ Role-based authorization (user, moderator, admin roles)
* ✅ Rate limiting with Rack::Attack (prevents brute force attacks)
@@ -232,7 +232,7 @@ feel free to fork, star, share, or improve.
## ⚠️ disclaimer
this template includes production-grade features like token blacklisting, refresh tokens, and role-based auth.
this template includes production-grade features like token retireing, refresh tokens, and role-based auth.
however, you should still:
* review security settings for your specific use case
* set up proper monitoring and logging