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