|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OAuth; |
|
4
|
|
|
|
|
5
|
|
|
use DateTime; |
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
8
|
|
|
use League\OAuth2\Server\Entities\AuthCodeEntityInterface; |
|
9
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface; |
|
10
|
|
|
use League\OAuth2\Server\Entities\ScopeEntityInterface; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @ORM\Entity(repositoryClass="OAuth\Repository\AuthCodeRepository") |
|
14
|
|
|
* @ORM\Table(name="AuthCode") |
|
15
|
|
|
*/ |
|
16
|
|
|
class AuthCode implements AuthCodeEntityInterface |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var null|string |
|
21
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $redirectUri; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var ArrayCollection $scopes |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $scopes; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var DateTime |
|
32
|
|
|
* @ORM\Column(type="datetime",nullable=true) |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $expiryDateTime; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var OAuthUser |
|
38
|
|
|
* @ORM\OneToOne(targetEntity="OAuth\OAuthUser") |
|
39
|
|
|
* @ORM\JoinColumn(name="client", referencedColumnName="id") |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $userIdentifier; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var ClientEntityInterface |
|
45
|
|
|
* @ORM\ManyToOne(targetEntity="OAuth\Client") |
|
46
|
|
|
* @ORM\JoinColumn(name="client", referencedColumnName="id") |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $client; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var string |
|
52
|
|
|
* @ORM\Column(type="text", nullable=false) |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $identifier; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var int |
|
58
|
|
|
* @ORM\Id |
|
59
|
|
|
* @ORM\Column(type="integer", nullable=false) |
|
60
|
|
|
* @ORM\GeneratedValue |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $id; |
|
63
|
|
|
|
|
64
|
6 |
|
public function __construct() |
|
65
|
|
|
{ |
|
66
|
6 |
|
$this->scopes = new ArrayCollection(); |
|
67
|
6 |
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
1 |
|
public function getIdentifier() |
|
73
|
|
|
{ |
|
74
|
1 |
|
return $this->identifier; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @param string $identifier |
|
79
|
|
|
*/ |
|
80
|
1 |
|
public function setIdentifier($identifier) |
|
81
|
|
|
{ |
|
82
|
1 |
|
$this->identifier = $identifier; |
|
83
|
1 |
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @param ScopeEntityInterface $scope |
|
87
|
|
|
* @return $this |
|
88
|
|
|
*/ |
|
89
|
1 |
|
public function addScope(ScopeEntityInterface $scope) |
|
90
|
|
|
{ |
|
91
|
1 |
|
$this->scopes->add($scope); |
|
92
|
1 |
|
return $this; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Return an array of scopes associated with the token. |
|
97
|
|
|
* |
|
98
|
|
|
* @return ScopeEntityInterface[] |
|
99
|
|
|
*/ |
|
100
|
1 |
|
public function getScopes() |
|
101
|
|
|
{ |
|
102
|
1 |
|
return $this->scopes->toArray(); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Get the token's expiry date time. |
|
107
|
|
|
* |
|
108
|
|
|
* @return DateTime |
|
109
|
|
|
*/ |
|
110
|
1 |
|
public function getExpiryDateTime() |
|
111
|
|
|
{ |
|
112
|
1 |
|
return $this->expiryDateTime; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Set the date time when the token expires. |
|
117
|
|
|
* |
|
118
|
|
|
* @param DateTime $dateTime |
|
119
|
|
|
*/ |
|
120
|
1 |
|
public function setExpiryDateTime(DateTime $dateTime) |
|
121
|
|
|
{ |
|
122
|
1 |
|
$this->expiryDateTime = $dateTime; |
|
123
|
1 |
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Set the identifier of the user associated with the token. |
|
127
|
|
|
* |
|
128
|
|
|
* @param User $identifier The identifier of the user |
|
|
|
|
|
|
129
|
|
|
*/ |
|
130
|
1 |
|
public function setUserIdentifier($identifier) |
|
131
|
|
|
{ |
|
132
|
1 |
|
$this->userIdentifier = $identifier; |
|
133
|
1 |
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Get the token user's identifier. |
|
137
|
|
|
* |
|
138
|
|
|
* @return User |
|
139
|
|
|
*/ |
|
140
|
1 |
|
public function getUserIdentifier() |
|
141
|
|
|
{ |
|
142
|
1 |
|
return $this->userIdentifier; |
|
|
|
|
|
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Get the client that the token was issued to. |
|
147
|
|
|
* |
|
148
|
|
|
* @return ClientEntityInterface |
|
149
|
|
|
*/ |
|
150
|
1 |
|
public function getClient() |
|
151
|
|
|
{ |
|
152
|
1 |
|
return $this->client; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* Set the client that the token was issued to. |
|
157
|
|
|
* |
|
158
|
|
|
* @param ClientEntityInterface $client |
|
159
|
|
|
*/ |
|
160
|
1 |
|
public function setClient(ClientEntityInterface $client) |
|
161
|
|
|
{ |
|
162
|
1 |
|
$this->client = $client; |
|
163
|
1 |
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @return string |
|
167
|
|
|
*/ |
|
168
|
1 |
|
public function getRedirectUri() |
|
169
|
|
|
{ |
|
170
|
1 |
|
return $this->redirectUri; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @param string $uri |
|
175
|
|
|
*/ |
|
176
|
1 |
|
public function setRedirectUri($uri) |
|
177
|
|
|
{ |
|
178
|
1 |
|
$this->redirectUri = $uri; |
|
179
|
|
|
} |
|
180
|
|
|
} |
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