404labfr / 404labfr/laravel-impersonate

[Bug]: Setting auth middleware in the controller stops use with multiple guards

Open
#233 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.3k
Forks
235
PR merge metrics
No merged PRs in 30d

Description

```php
// src/Controllers/ImpersonateController.php

public function __construct()
{
$this->manager = app()->make(ImpersonateManager::class);

$guard = $this->manager->getDefaultSessionGuard();
$this->middleware('auth:' . $guard)->only('take');
}
```

While it's important to encourage security, this forced middleware in the constructor means that if you're using this package for impersonating anything other than the default guard, it won't work since it'll just redirect to login.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.