1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* The MIT License (MIT) |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2014-2018 Spomky-Labs |
9
|
|
|
* |
10
|
|
|
* This software may be modified and distributed under the terms |
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace OAuth2Framework\Component\RefreshTokenGrant\Event; |
15
|
|
|
|
16
|
|
|
use OAuth2Framework\Component\Core\Event\Event; |
17
|
|
|
use OAuth2Framework\Component\Core\Id\Id; |
18
|
|
|
use OAuth2Framework\Component\RefreshTokenGrant\RefreshTokenId; |
19
|
|
|
use OAuth2Framework\Component\Core\Domain\DomainObject; |
20
|
|
|
|
21
|
|
|
class RefreshTokenRevokedEvent extends Event |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var RefreshTokenId |
25
|
|
|
*/ |
26
|
|
|
private $refreshTokenId; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* RefreshTokenRevokedEvent constructor. |
30
|
|
|
* |
31
|
|
|
* @param RefreshTokenId $refreshTokenId |
32
|
|
|
*/ |
33
|
|
|
protected function __construct(RefreshTokenId $refreshTokenId) |
34
|
|
|
{ |
35
|
|
|
$this->refreshTokenId = $refreshTokenId; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@inheritdoc} |
40
|
|
|
*/ |
41
|
|
|
public static function getSchema(): string |
42
|
|
|
{ |
43
|
|
|
return 'https://oauth2-framework.spomky-labs.com/schemas/events/refresh-token/revoked/1.0/schema'; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param RefreshTokenId $refreshTokenId |
48
|
|
|
* |
49
|
|
|
* @return RefreshTokenRevokedEvent |
50
|
|
|
*/ |
51
|
|
|
public static function create(RefreshTokenId $refreshTokenId): self |
52
|
|
|
{ |
53
|
|
|
return new self($refreshTokenId); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return RefreshTokenId |
58
|
|
|
*/ |
59
|
|
|
public function getRefreshTokenId(): RefreshTokenId |
60
|
|
|
{ |
61
|
|
|
return $this->refreshTokenId; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* {@inheritdoc} |
66
|
|
|
*/ |
67
|
|
|
public function getDomainId(): Id |
68
|
|
|
{ |
69
|
|
|
return $this->getRefreshTokenId(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
|
|
public function getPayload() |
76
|
|
|
{ |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* {@inheritdoc} |
81
|
|
|
*/ |
82
|
|
|
public static function createFromJson(\stdClass $json): DomainObject |
83
|
|
|
{ |
84
|
|
|
$refreshTokenId = RefreshTokenId::create($json->domain_id); |
85
|
|
|
|
86
|
|
|
return new self($refreshTokenId); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|