1
0
Fork 0
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:
lukinovec 2022-09-02 17:46:27 +02:00 committed by GitHub
parent f83504ac6f
commit 3bf2c39e1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 11 deletions

View 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.");
}
}