rickycezar/laravel-jwt-impersonate
tymon/jwt-auth), aligning with modern Laravel security patterns.auth.attempt() or once() methods.tymon/jwt-auth (v1.x) and Laravel 5.8–8.x. Breaking: Last release in 2021; compatibility with newer Laravel/JWT versions (e.g., php-jwt) untested.luxuryparty/php-jwt or Laravel Sanctum if JWT is a hard dependency.Impersonate middleware/facade for switching users via JWT payload manipulation.Illuminate\Contracts\Auth\Authenticatable).tymon/jwt-auth a hard requirement, or can we use Sanctum/Laravel Passport?Auth::guard() logic?tymon/jwt-auth (v1.x) or alternatives like php-jwt.Route::middleware(['impersonate'])).users table; custom user models may need adapter logic.tymon/jwt-auth compatibility or plan alternative (e.g., Sanctum + custom middleware).tymon/jwt-auth (v1.x).php-jwt/luxuryparty/php-jwt.Impersonate facade or middleware to support non-standard users tables.tymon/jwt-auth (or alternative) and configure JWT guards.auth:api middleware is properly routed.php artisan vendor:publish --provider="Rickycezar\LaravelJwtImpersonate\ServiceProvider").app/Http/Kernel.php:
'impersonate' => \Rickycezar\LaravelJwtImpersonate\Middleware\Impersonate::class,
POST /impersonate):
Route::post('/impersonate', [ImpersonateController::class, 'impersonate'])->middleware('auth:api');
/impersonate endpoint).tymon/jwt-auth for breaking changes.php-jwt if tymon/jwt-auth is deprecated.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| JWT token leakage | Unauthorized impersonation | Enforce short-lived tokens + logging |
| Middleware misconfiguration | Broken impersonation flow | Unit tests for middleware triggers |
| Database schema mismatch | Impersonation fails silently | Validate user model compatibility |
| Package abandonment | No security updates | Fork and maintain internally |
| Nested impersonation (admin → user → admin) | Privilege escalation | Enforce depth limits in middleware |
How can I help you explore Laravel packages today?