|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OAuth; |
|
4
|
|
|
|
|
5
|
|
|
use DateTime; |
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
7
|
|
|
use League\OAuth2\Server\Entities\AccessTokenEntityInterface; |
|
8
|
|
|
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; |
|
9
|
|
|
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @ORM\Entity(repositoryClass="OAuth\Repository\RefreshTokenRepository") |
|
13
|
|
|
* @ORM\Table(name="RefreshToken") |
|
14
|
|
|
*/ |
|
15
|
|
|
class RefreshToken implements RefreshTokenEntityInterface |
|
16
|
|
|
{ |
|
17
|
|
|
use RefreshTokenTrait; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
* @ORM\Id |
|
22
|
|
|
* @ORM\Column(type="string", length=40) |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $identifier; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var AccessTokenEntityInterface |
|
28
|
|
|
* @ORM\OneToOne(targetEntity="OAuth\AccessToken") |
|
29
|
|
|
* @ORM\JoinColumn(name="accessToken", referencedColumnName="identifier") |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $accessToken; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var DateTime |
|
35
|
|
|
* @ORM\Column(type="date",nullable=true) |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $expiryDateTime; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* {@inheritdoc} |
|
41
|
|
|
*/ |
|
42
|
|
|
public function setAccessToken(AccessTokenEntityInterface $accessToken) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->accessToken = $accessToken; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* {@inheritdoc} |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getAccessToken() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->accessToken; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Get the token's expiry date time. |
|
57
|
|
|
* |
|
58
|
|
|
* @return DateTime |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getExpiryDateTime() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->expiryDateTime; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Set the date time when the token expires. |
|
67
|
|
|
* |
|
68
|
|
|
* @param DateTime $dateTime |
|
69
|
|
|
*/ |
|
70
|
|
|
public function setExpiryDateTime(DateTime $dateTime) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->expiryDateTime = $dateTime; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return mixed |
|
77
|
|
|
*/ |
|
78
|
|
|
public function getIdentifier() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->identifier; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @param mixed $identifier |
|
85
|
|
|
*/ |
|
86
|
|
|
public function setIdentifier($identifier) |
|
87
|
|
|
{ |
|
88
|
|
|
$this->identifier = $identifier; |
|
89
|
|
|
} |
|
90
|
|
|
} |