1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
5
|
|
|
* Use of this software requires acceptance of the Spryker Marketplace License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Spryker\Zed\AgentSecurityMerchantPortalGui\Communication\Security; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\UserTransfer; |
11
|
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; |
12
|
|
|
|
13
|
|
|
class AgentMerchantUser implements AgentMerchantUserInterface, PasswordAuthenticatedUserInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var \Generated\Shared\Transfer\UserTransfer |
17
|
|
|
*/ |
18
|
|
|
protected UserTransfer $userTransfer; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected string $username; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected string $password; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var list<string> |
32
|
|
|
*/ |
33
|
|
|
protected array $roles = []; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param \Generated\Shared\Transfer\UserTransfer $userTransfer |
37
|
|
|
* @param list<string> $roles |
38
|
|
|
*/ |
39
|
|
|
public function __construct(UserTransfer $userTransfer, array $roles = []) |
40
|
|
|
{ |
41
|
|
|
$this->userTransfer = $userTransfer; |
42
|
|
|
$this->username = $userTransfer->getUsernameOrFail(); |
43
|
|
|
$this->password = $userTransfer->getPasswordOrFail(); |
44
|
|
|
$this->roles = $roles; |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return list<string> |
49
|
|
|
*/ |
50
|
|
|
public function getRoles(): array |
51
|
|
|
{ |
52
|
|
|
return $this->roles; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return string|null |
57
|
|
|
*/ |
58
|
|
|
public function getSalt(): ?string |
59
|
|
|
{ |
60
|
|
|
return null; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
|
public function getUsername(): string |
67
|
|
|
{ |
68
|
|
|
return $this->username; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return string |
73
|
|
|
*/ |
74
|
|
|
public function getPassword(): string |
75
|
|
|
{ |
76
|
|
|
return $this->password; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return void |
81
|
|
|
*/ |
82
|
|
|
public function eraseCredentials(): void |
83
|
|
|
{ |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return \Generated\Shared\Transfer\UserTransfer |
88
|
|
|
*/ |
89
|
|
|
public function getUserTransfer(): UserTransfer |
90
|
|
|
{ |
91
|
|
|
return $this->userTransfer; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
|
|
public function getUserIdentifier(): string |
98
|
|
|
{ |
99
|
|
|
return $this->username; |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..