Phase 2.3: Complete JWT Authentication with token rotation and revocation
- Fixed DateTime timestamp issues (use timestamp_millis instead of to_millis) - Implemented token rotation: old refresh tokens revoked on refresh - Implemented logout revocation: tokens immediately marked as revoked - Removed rate limiting (deferred to Phase 2.6) - Created comprehensive verification report - Updated STATUS.md All Phase 2.3 objectives complete: ✅ JWT Access Tokens (15 min expiry) ✅ JWT Refresh Tokens (30 day expiry) ✅ Token Rotation ✅ Token Revocation ✅ PBKDF2 Password Hashing ✅ Auth endpoints (register, login, refresh, logout) ✅ Protected routes with JWT middleware ✅ Health check endpoints Compiles successfully with only unused code warnings.
This commit is contained in:
parent
8b2c13501f
commit
02b24a3ac1
6 changed files with 480 additions and 55 deletions
|
|
@ -46,18 +46,21 @@ async fn main() -> anyhow::Result<()> {
|
|||
};
|
||||
|
||||
let app = Router::new()
|
||||
// Public endpoints (no auth required)
|
||||
.route("/health", get(handlers::health_check))
|
||||
.route("/ready", get(handlers::ready_check))
|
||||
.route("/api/auth/register", post(handlers::register))
|
||||
.route("/api/auth/login", post(handlers::login))
|
||||
.route("/api/auth/refresh", post(handlers::refresh_token))
|
||||
.route("/api/auth/logout", post(handlers::logout))
|
||||
// Protected endpoints (auth required)
|
||||
.route("/api/users/me", get(handlers::get_profile))
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.layer(CorsLayer::new())
|
||||
)
|
||||
// Apply auth middleware to all routes
|
||||
.route_layer(axum_middleware::from_fn_with_state(
|
||||
app_state.clone(),
|
||||
crate::middleware::auth::jwt_auth_middleware
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue