mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 03:54:02 +00:00
[4.x] Make impersonation tokens require stateful guards (#935)
* Throw an exception on attempt to create impersonation token with a non-stateful guard * Test that impersonation tokens can only be created with a stateful guard * Fix code style (php-cs-fixer) * Escape backslashes in the exception's message Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com> * Make the exception only about requiring a stateful guard Co-authored-by: PHP CS Fixer <phpcsfixer@example.com> Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
f83504ac6f
commit
3bf2c39e1a
3 changed files with 77 additions and 11 deletions
15
src/Exceptions/StatefulGuardRequiredException.php
Normal file
15
src/Exceptions/StatefulGuardRequiredException.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class StatefulGuardRequiredException extends Exception
|
||||
{
|
||||
public function __construct(string $guardName)
|
||||
{
|
||||
parent::__construct("Cannot use a non-stateful guard ('$guardName'). A guard implementing the Illuminate\\Contracts\\Auth\\StatefulGuard interface is required.");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue