1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of web-stack |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace Slick\WebStack\Domain\Security\Authentication\Token; |
13
|
|
|
|
14
|
|
|
use Slick\WebStack\Domain\Security\Authentication\TokenInterface; |
15
|
|
|
use Slick\WebStack\Domain\Security\Common\AttributesBagMethods; |
16
|
|
|
use Slick\WebStack\Domain\Security\UserInterface; |
17
|
|
|
use SensitiveParameter; |
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* RememberMeToken |
21
|
|
|
* |
22
|
|
|
* @package Slick\WebStack\Domain\Security\Authentication\Token |
23
|
|
|
* @template-covariant TUser of UserInterface |
24
|
|
|
* |
25
|
|
|
* @extends AbstractToken<TUser> |
26
|
|
|
* @implements TokenInterface<TUser> |
27
|
|
|
*/ |
28
|
|
|
final class RememberMeToken extends AbstractToken implements TokenInterface |
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Creates a RememberMeToken |
33
|
|
|
* |
34
|
|
|
* @param UserInterface $user |
35
|
|
|
* @phpstan-param TUser $user |
36
|
|
|
* @param string $secret |
37
|
|
|
*/ |
38
|
|
|
public function __construct( |
39
|
|
|
UserInterface $user, |
40
|
|
|
#[SensitiveParameter] |
41
|
|
|
private string $secret |
42
|
|
|
) { |
43
|
|
|
$this->user = $user; |
44
|
|
|
$roles = $this->user()?->roles(); |
45
|
|
|
parent::__construct($roles ?? []); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* RememberMeToken secret |
50
|
|
|
* |
51
|
|
|
* @return string |
52
|
|
|
*/ |
53
|
|
|
public function secret(): string |
54
|
|
|
{ |
55
|
|
|
return $this->secret; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @inheritDoc |
60
|
|
|
*/ |
61
|
|
|
public function __serialize(): array |
62
|
|
|
{ |
63
|
|
|
return [$this->secret, parent::__serialize()]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @inheritDoc |
68
|
|
|
* @param array<string|int, mixed> $data |
69
|
|
|
*/ |
70
|
|
|
public function __unserialize(array $data): void |
71
|
|
|
{ |
72
|
|
|
[$this->secret, $parentData] = $data; |
73
|
|
|
$parentData = is_array($parentData) ? $parentData : unserialize($parentData); |
74
|
|
|
parent::__unserialize($parentData); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths