|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types = 1); |
|
3
|
|
|
/** |
|
4
|
|
|
* /src/Security/SecurityUser.php |
|
5
|
|
|
* |
|
6
|
|
|
* @author TLe, Tarmo Leppänen <[email protected]> |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace App\Security; |
|
10
|
|
|
|
|
11
|
|
|
use App\Entity\User; |
|
12
|
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; |
|
13
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class SecurityUser |
|
17
|
|
|
* |
|
18
|
|
|
* @package App\Security |
|
19
|
|
|
* @author TLe, Tarmo Leppänen <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class SecurityUser implements UserInterface, PasswordAuthenticatedUserInterface |
|
22
|
|
|
{ |
|
23
|
|
|
private string $username; |
|
24
|
|
|
private string | null $password; |
|
|
|
|
|
|
25
|
|
|
private string $language; |
|
26
|
|
|
private string $locale; |
|
27
|
|
|
private string $timezone; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var array<int, string> |
|
31
|
|
|
*/ |
|
32
|
|
|
private array $roles; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* SecurityUser constructor. |
|
36
|
|
|
* |
|
37
|
|
|
* @param array<int, string> $roles |
|
38
|
|
|
*/ |
|
39
|
297 |
|
public function __construct(User $user, array $roles = []) |
|
40
|
|
|
{ |
|
41
|
297 |
|
$this->username = $user->getId(); |
|
42
|
297 |
|
$this->password = $user->getPassword(); |
|
43
|
297 |
|
$this->language = $user->getLanguage(); |
|
44
|
297 |
|
$this->locale = $user->getLocale(); |
|
45
|
297 |
|
$this->timezone = $user->getTimezone(); |
|
46
|
297 |
|
$this->roles = $roles; |
|
47
|
297 |
|
} |
|
48
|
|
|
|
|
49
|
37 |
|
public function getUuid(): string |
|
50
|
|
|
{ |
|
51
|
37 |
|
return $this->getUserIdentifier(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* {@inheritdoc} |
|
56
|
|
|
* |
|
57
|
|
|
* @return array<int, string> The user roles |
|
58
|
|
|
*/ |
|
59
|
256 |
|
public function getRoles(): array |
|
60
|
|
|
{ |
|
61
|
256 |
|
return $this->roles; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* {@inheritdoc} |
|
66
|
|
|
* |
|
67
|
|
|
* @codeCoverageIgnore |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getPassword(): ?string |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->password; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* {@inheritdoc} |
|
76
|
|
|
* |
|
77
|
|
|
* @codeCoverageIgnore |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getSalt(): ?string |
|
80
|
|
|
{ |
|
81
|
|
|
return null; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
275 |
|
public function getUserIdentifier(): string |
|
85
|
|
|
{ |
|
86
|
275 |
|
return $this->username; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
24 |
|
public function getLanguage(): string |
|
90
|
|
|
{ |
|
91
|
24 |
|
return $this->language; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
24 |
|
public function getLocale(): string |
|
95
|
|
|
{ |
|
96
|
24 |
|
return $this->locale; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
24 |
|
public function getTimezone(): string |
|
100
|
|
|
{ |
|
101
|
24 |
|
return $this->timezone; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* {@inheritdoc} |
|
106
|
|
|
* |
|
107
|
|
|
* @codeCoverageIgnore |
|
108
|
|
|
*/ |
|
109
|
|
|
public function eraseCredentials(): void |
|
110
|
|
|
{ |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @todo Remove this when this `getUsername` is removed from main interface (Symfony 6.0) |
|
115
|
|
|
* |
|
116
|
|
|
* {@inheritdoc} |
|
117
|
|
|
* |
|
118
|
|
|
* @codeCoverageIgnore |
|
119
|
|
|
*/ |
|
120
|
|
|
public function getUsername(): string |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->getUserIdentifier(); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
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