5. Middleware for authentication