1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* The MIT License (MIT) |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2014-2017 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\Server\Command\PreConfiguredAuthorization; |
15
|
|
|
|
16
|
|
|
use OAuth2Framework\Component\Server\Command\CommandWithDataTransporter; |
17
|
|
|
use OAuth2Framework\Component\Server\DataTransporter; |
18
|
|
|
use OAuth2Framework\Component\Server\Model\Client\ClientId; |
19
|
|
|
use OAuth2Framework\Component\Server\Model\ResourceServer\ResourceServerId; |
20
|
|
|
use OAuth2Framework\Component\Server\Model\UserAccount\UserAccountId; |
21
|
|
|
|
22
|
|
|
final class RevokePreConfiguredAuthorizationCommand extends CommandWithDataTransporter |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var UserAccountId |
26
|
|
|
*/ |
27
|
|
|
private $userAccountId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var ClientId |
31
|
|
|
*/ |
32
|
|
|
private $clientId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string[] |
36
|
|
|
*/ |
37
|
|
|
private $scopes; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var null|ResourceServerId |
41
|
|
|
*/ |
42
|
|
|
private $resourceServerId; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* RevokePreConfiguredAuthorizationCommand constructor. |
46
|
|
|
* |
47
|
|
|
* @param ClientId $clientId |
48
|
|
|
* @param UserAccountId $userAccountId |
49
|
|
|
* @param array $scopes |
50
|
|
|
* @param null|ResourceServerId $resourceServerId |
51
|
|
|
* @param DataTransporter|null $dataTransporter |
52
|
|
|
*/ |
53
|
|
|
protected function __construct(ClientId $clientId, UserAccountId $userAccountId, array $scopes, ?ResourceServerId $resourceServerId, ? DataTransporter $dataTransporter) |
54
|
|
|
{ |
55
|
|
|
parent::__construct($dataTransporter); |
56
|
|
|
$this->clientId = $clientId; |
57
|
|
|
$this->userAccountId = $userAccountId; |
58
|
|
|
$this->resourceServerId = $resourceServerId; |
59
|
|
|
$this->scopes = $scopes; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param ClientId $clientId |
64
|
|
|
* @param UserAccountId $userAccountId |
65
|
|
|
* @param array $scopes |
66
|
|
|
* @param null|ResourceServerId $resourceServerId |
67
|
|
|
* @param null|DataTransporter $dataTransporter |
68
|
|
|
* |
69
|
|
|
* @return RevokePreConfiguredAuthorizationCommand |
70
|
|
|
*/ |
71
|
|
|
public static function create(ClientId $clientId, UserAccountId $userAccountId, array $scopes, ?ResourceServerId $resourceServerId, ? DataTransporter $dataTransporter): RevokePreConfiguredAuthorizationCommand |
72
|
|
|
{ |
73
|
|
|
return new self($clientId, $userAccountId, $scopes, $resourceServerId, $dataTransporter); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return UserAccountId |
78
|
|
|
*/ |
79
|
|
|
public function getUserAccountId(): UserAccountId |
80
|
|
|
{ |
81
|
|
|
return $this->userAccountId; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return ClientId |
86
|
|
|
*/ |
87
|
|
|
public function getClientId(): ClientId |
88
|
|
|
{ |
89
|
|
|
return $this->clientId; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return array |
94
|
|
|
*/ |
95
|
|
|
public function getScopes(): array |
96
|
|
|
{ |
97
|
|
|
return $this->scopes; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return null|ResourceServerId |
102
|
|
|
*/ |
103
|
|
|
public function getResourceServerId(): ?ResourceServerId |
104
|
|
|
{ |
105
|
|
|
return $this->resourceServerId; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|