|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @author Alex Bilbie <[email protected]> |
|
5
|
|
|
* @copyright Copyright (c) Alex Bilbie |
|
6
|
|
|
* @license http://mit-license.org/ |
|
7
|
|
|
* |
|
8
|
|
|
* @link https://github.com/thephpleague/oauth2-server |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
declare(strict_types=1); |
|
12
|
|
|
|
|
13
|
|
|
namespace League\OAuth2\Server\RequestTypes; |
|
14
|
|
|
|
|
15
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface; |
|
16
|
|
|
use League\OAuth2\Server\Entities\ScopeEntityInterface; |
|
17
|
|
|
use League\OAuth2\Server\Entities\UserEntityInterface; |
|
18
|
|
|
|
|
19
|
|
|
class AuthorizationRequest implements AuthorizationRequestInterface |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* The grant type identifier |
|
23
|
|
|
*/ |
|
24
|
|
|
protected string $grantTypeId; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* The client identifier |
|
28
|
|
|
*/ |
|
29
|
|
|
protected ClientEntityInterface $client; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* The user identifier |
|
33
|
|
|
*/ |
|
34
|
|
|
protected UserEntityInterface $user; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* An array of scope identifiers |
|
38
|
|
|
* |
|
39
|
|
|
* @var ScopeEntityInterface[] |
|
40
|
|
|
*/ |
|
41
|
|
|
protected array $scopes = []; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Has the user authorized the authorization request |
|
45
|
|
|
*/ |
|
46
|
|
|
protected bool $authorizationApproved = false; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* The redirect URI used in the request |
|
50
|
|
|
*/ |
|
51
|
|
|
protected ?string $redirectUri = null; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* The state parameter on the authorization request |
|
55
|
|
|
*/ |
|
56
|
|
|
protected ?string $state = null; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* The code challenge (if provided) |
|
60
|
|
|
*/ |
|
61
|
|
|
protected string $codeChallenge; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* The code challenge method (if provided) |
|
65
|
|
|
*/ |
|
66
|
|
|
protected string $codeChallengeMethod; |
|
67
|
|
|
|
|
68
|
2 |
|
public function getGrantTypeId(): string |
|
69
|
|
|
{ |
|
70
|
2 |
|
return $this->grantTypeId; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
22 |
|
public function setGrantTypeId(string $grantTypeId): void |
|
74
|
|
|
{ |
|
75
|
22 |
|
$this->grantTypeId = $grantTypeId; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
12 |
|
public function getClient(): ClientEntityInterface |
|
79
|
|
|
{ |
|
80
|
12 |
|
return $this->client; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
21 |
|
public function setClient(ClientEntityInterface $client): void |
|
84
|
|
|
{ |
|
85
|
21 |
|
$this->client = $client; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
14 |
|
public function getUser(): ?UserEntityInterface |
|
89
|
|
|
{ |
|
90
|
14 |
|
return $this->user ?? null; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
12 |
|
public function setUser(UserEntityInterface $user): void |
|
94
|
|
|
{ |
|
95
|
12 |
|
$this->user = $user; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return ScopeEntityInterface[] |
|
100
|
|
|
*/ |
|
101
|
10 |
|
public function getScopes(): array |
|
102
|
|
|
{ |
|
103
|
10 |
|
return $this->scopes; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param ScopeEntityInterface[] $scopes |
|
108
|
|
|
*/ |
|
109
|
9 |
|
public function setScopes(array $scopes): void |
|
110
|
|
|
{ |
|
111
|
9 |
|
$this->scopes = $scopes; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
12 |
|
public function isAuthorizationApproved(): bool |
|
115
|
|
|
{ |
|
116
|
12 |
|
return $this->authorizationApproved; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
12 |
|
public function setAuthorizationApproved(bool $authorizationApproved): void |
|
120
|
|
|
{ |
|
121
|
12 |
|
$this->authorizationApproved = $authorizationApproved; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
13 |
|
public function getRedirectUri(): ?string |
|
125
|
|
|
{ |
|
126
|
13 |
|
return $this->redirectUri; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
9 |
|
public function setRedirectUri(?string $redirectUri): void |
|
130
|
|
|
{ |
|
131
|
9 |
|
$this->redirectUri = $redirectUri; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
8 |
|
public function getState(): ?string |
|
135
|
|
|
{ |
|
136
|
8 |
|
return $this->state; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
3 |
|
public function setState(string $state): void |
|
140
|
|
|
{ |
|
141
|
3 |
|
$this->state = $state; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
4 |
|
public function getCodeChallenge(): ?string |
|
145
|
|
|
{ |
|
146
|
4 |
|
return $this->codeChallenge ?? null; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
1 |
|
public function setCodeChallenge(string $codeChallenge): void |
|
150
|
|
|
{ |
|
151
|
1 |
|
$this->codeChallenge = $codeChallenge; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
4 |
|
public function getCodeChallengeMethod(): ?string |
|
155
|
|
|
{ |
|
156
|
4 |
|
return $this->codeChallengeMethod ?? null; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
1 |
|
public function setCodeChallengeMethod(string $codeChallengeMethod): void |
|
160
|
|
|
{ |
|
161
|
1 |
|
$this->codeChallengeMethod = $codeChallengeMethod; |
|
162
|
|
|
} |
|
163
|
|
|
} |
|
164
|
|
|
|