1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Limoncello\Passport\Entities; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015-2019 [email protected] |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use DateTimeInterface; |
22
|
|
|
use Limoncello\Passport\Contracts\Entities\ClientInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @package Limoncello\Passport |
26
|
|
|
* |
27
|
|
|
* @SuppressWarnings(PHPMD.TooManyMethods) |
28
|
|
|
* @SuppressWarnings(PHPMD.TooManyPublicMethods) |
29
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
30
|
|
|
*/ |
31
|
|
|
abstract class Client extends DatabaseItem implements ClientInterface |
32
|
|
|
{ |
33
|
|
|
/** Field name */ |
34
|
|
|
const FIELD_ID = 'id_client'; |
35
|
|
|
|
36
|
|
|
/** Field name */ |
37
|
|
|
const FIELD_NAME = 'name'; |
38
|
|
|
|
39
|
|
|
/** Field name */ |
40
|
|
|
const FIELD_DESCRIPTION = 'description'; |
41
|
|
|
|
42
|
|
|
/** Field name */ |
43
|
|
|
const FIELD_CREDENTIALS = 'credentials'; |
44
|
|
|
|
45
|
|
|
/** Field name */ |
46
|
|
|
const FIELD_REDIRECT_URIS = 'redirect_uris'; |
47
|
|
|
|
48
|
|
|
/** Field name */ |
49
|
|
|
const FIELD_SCOPES = 'scopes'; |
50
|
|
|
|
51
|
|
|
/** Field name */ |
52
|
|
|
const FIELD_IS_CONFIDENTIAL = 'is_confidential'; |
53
|
|
|
|
54
|
|
|
/** Field name */ |
55
|
|
|
const FIELD_IS_USE_DEFAULT_SCOPE = 'is_use_default_scope'; |
56
|
|
|
|
57
|
|
|
/** Field name */ |
58
|
|
|
const FIELD_IS_SCOPE_EXCESS_ALLOWED = 'is_scope_excess_allowed'; |
59
|
|
|
|
60
|
|
|
/** Field name */ |
61
|
|
|
const FIELD_IS_CODE_GRANT_ENABLED = 'is_code_grant_enabled'; |
62
|
|
|
|
63
|
|
|
/** Field name */ |
64
|
|
|
const FIELD_IS_IMPLICIT_GRANT_ENABLED = 'is_implicit_grant_enabled'; |
65
|
|
|
|
66
|
|
|
/** Field name */ |
67
|
|
|
const FIELD_IS_PASSWORD_GRANT_ENABLED = 'is_password_grant_enabled'; |
68
|
|
|
|
69
|
|
|
/** Field name */ |
70
|
|
|
const FIELD_IS_CLIENT_GRANT_ENABLED = 'is_client_grant_enabled'; |
71
|
|
|
|
72
|
|
|
/** Field name */ |
73
|
|
|
const FIELD_IS_REFRESH_GRANT_ENABLED = 'is_refresh_grant_enabled'; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var string |
77
|
|
|
*/ |
78
|
|
|
private $identifierField = ''; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var string|null |
82
|
|
|
*/ |
83
|
|
|
private $nameField = null; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @var string|null |
87
|
|
|
*/ |
88
|
|
|
private $descriptionField = null; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var string|null |
92
|
|
|
*/ |
93
|
|
|
private $credentialsField = null; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var string[] |
97
|
|
|
*/ |
98
|
|
|
private $redirectUriStrings; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @var string[] |
102
|
|
|
*/ |
103
|
|
|
private $scopeIdentifiers; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @var bool |
107
|
|
|
*/ |
108
|
|
|
private $isConfidentialField = false; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @var bool |
112
|
|
|
*/ |
113
|
|
|
private $isUseDefaultScopeField = false; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @var bool |
117
|
|
|
*/ |
118
|
|
|
private $isScopeExcessAllowedField = false; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var bool |
122
|
|
|
*/ |
123
|
|
|
private $isCodeAuthEnabledField = false; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @var bool |
127
|
|
|
*/ |
128
|
|
|
private $isImplicitAuthEnabledField = false; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @var bool |
132
|
|
|
*/ |
133
|
|
|
private $isPasswordGrantEnabledField = false; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @var bool |
137
|
|
|
*/ |
138
|
|
|
private $isClientGrantEnabledField = false; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @var bool |
142
|
|
|
*/ |
143
|
|
|
private $isRefreshGrantEnabledField = false; |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Constructor. |
147
|
|
|
* |
148
|
|
|
* @SuppressWarnings(PHPMD.ElseExpression) |
149
|
|
|
*/ |
150
|
33 |
|
public function __construct() |
151
|
|
|
{ |
152
|
33 |
|
if ($this->hasDynamicProperty(static::FIELD_ID) === true) { |
153
|
|
|
$this |
154
|
17 |
|
->setIdentifier($this->{static::FIELD_ID}) |
155
|
17 |
|
->setName($this->{static::FIELD_NAME}) |
156
|
17 |
|
->setDescription($this->{static::FIELD_DESCRIPTION}) |
157
|
17 |
|
->setCredentials($this->{static::FIELD_CREDENTIALS}); |
158
|
|
|
$this |
159
|
17 |
|
->parseIsConfidential($this->{static::FIELD_IS_CONFIDENTIAL}) |
160
|
17 |
|
->parseIsUseDefaultScope($this->{static::FIELD_IS_USE_DEFAULT_SCOPE}) |
161
|
17 |
|
->parseIsScopeExcessAllowed($this->{static::FIELD_IS_SCOPE_EXCESS_ALLOWED}) |
162
|
17 |
|
->parseIsCodeAuthEnabled($this->{static::FIELD_IS_CODE_GRANT_ENABLED}) |
163
|
17 |
|
->parseIsImplicitAuthEnabled($this->{static::FIELD_IS_IMPLICIT_GRANT_ENABLED}) |
164
|
17 |
|
->parseIsPasswordGrantEnabled($this->{static::FIELD_IS_PASSWORD_GRANT_ENABLED}) |
165
|
17 |
|
->parseIsClientGrantEnabled($this->{static::FIELD_IS_CLIENT_GRANT_ENABLED}) |
166
|
17 |
|
->parseIsRefreshGrantEnabled($this->{static::FIELD_IS_REFRESH_GRANT_ENABLED}); |
167
|
|
|
} else { |
168
|
|
|
$this-> |
169
|
31 |
|
setScopeIdentifiers([])->setRedirectUriStrings([]); |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @inheritdoc |
175
|
|
|
*/ |
176
|
27 |
|
public function getIdentifier(): string |
177
|
|
|
{ |
178
|
27 |
|
return $this->identifierField; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @inheritdoc |
183
|
|
|
*/ |
184
|
26 |
|
public function setIdentifier(string $identifier): ClientInterface |
185
|
|
|
{ |
186
|
26 |
|
$this->identifierField = $identifier; |
187
|
|
|
|
188
|
26 |
|
return $this; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @inheritdoc |
193
|
|
|
*/ |
194
|
26 |
|
public function getName(): ?string |
195
|
|
|
{ |
196
|
26 |
|
return $this->nameField; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @inheritdoc |
201
|
|
|
*/ |
202
|
26 |
|
public function setName(string $name): ClientInterface |
203
|
|
|
{ |
204
|
26 |
|
$this->nameField = $name; |
205
|
|
|
|
206
|
26 |
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @inheritdoc |
211
|
|
|
*/ |
212
|
26 |
|
public function getDescription(): ?string |
213
|
|
|
{ |
214
|
26 |
|
return $this->descriptionField; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @inheritdoc |
219
|
|
|
*/ |
220
|
17 |
|
public function setDescription(string $description = null): ClientInterface |
221
|
|
|
{ |
222
|
17 |
|
$this->descriptionField = $description; |
223
|
|
|
|
224
|
17 |
|
return $this; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @inheritdoc |
229
|
|
|
*/ |
230
|
27 |
|
public function getCredentials(): ?string |
231
|
|
|
{ |
232
|
27 |
|
return $this->credentialsField; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @inheritdoc |
237
|
|
|
*/ |
238
|
19 |
|
public function setCredentials(string $credentials = null): ClientInterface |
239
|
|
|
{ |
240
|
19 |
|
$this->credentialsField = $credentials; |
241
|
|
|
|
242
|
19 |
|
return $this; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @inheritdoc |
247
|
|
|
*/ |
248
|
7 |
|
public function hasCredentials(): bool |
249
|
|
|
{ |
250
|
7 |
|
return empty($this->getCredentials()) === false; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @inheritdoc |
255
|
|
|
*/ |
256
|
8 |
|
public function getRedirectUriStrings(): array |
257
|
|
|
{ |
258
|
8 |
|
return $this->redirectUriStrings; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @inheritdoc |
263
|
|
|
*/ |
264
|
33 |
|
public function setRedirectUriStrings(array $redirectUriStrings): ClientInterface |
265
|
|
|
{ |
266
|
33 |
|
$this->redirectUriStrings = $redirectUriStrings; |
267
|
|
|
|
268
|
33 |
|
return $this; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @inheritdoc |
273
|
|
|
*/ |
274
|
28 |
|
public function getScopeIdentifiers(): array |
275
|
|
|
{ |
276
|
28 |
|
return $this->scopeIdentifiers; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @param string[] $scopeIdentifiers |
281
|
|
|
* |
282
|
|
|
* @return ClientInterface |
283
|
|
|
*/ |
284
|
33 |
|
public function setScopeIdentifiers(array $scopeIdentifiers): ClientInterface |
285
|
|
|
{ |
286
|
33 |
|
$this->scopeIdentifiers = $scopeIdentifiers; |
287
|
|
|
|
288
|
33 |
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @inheritdoc |
293
|
|
|
*/ |
294
|
28 |
|
public function isConfidential(): bool |
295
|
|
|
{ |
296
|
28 |
|
return $this->isConfidentialField; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @inheritdoc |
301
|
|
|
*/ |
302
|
1 |
|
public function isPublic(): bool |
303
|
|
|
{ |
304
|
1 |
|
return $this->isConfidential() === false; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @inheritdoc |
309
|
|
|
*/ |
310
|
3 |
|
public function setConfidential(): ClientInterface |
311
|
|
|
{ |
312
|
3 |
|
$this->isConfidentialField = true; |
313
|
|
|
|
314
|
3 |
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @inheritdoc |
319
|
|
|
*/ |
320
|
16 |
|
public function setPublic(): ClientInterface |
321
|
|
|
{ |
322
|
16 |
|
$this->isConfidentialField = false; |
323
|
|
|
|
324
|
16 |
|
return $this; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* @inheritdoc |
329
|
|
|
*/ |
330
|
26 |
|
public function isUseDefaultScopesOnEmptyRequest(): bool |
331
|
|
|
{ |
332
|
26 |
|
return $this->isUseDefaultScopeField; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @inheritdoc |
337
|
|
|
*/ |
338
|
16 |
|
public function useDefaultScopesOnEmptyRequest(): ClientInterface |
339
|
|
|
{ |
340
|
16 |
|
$this->isUseDefaultScopeField = true; |
341
|
|
|
|
342
|
16 |
|
return $this; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* @inheritdoc |
347
|
|
|
*/ |
348
|
4 |
|
public function doNotUseDefaultScopesOnEmptyRequest(): ClientInterface |
349
|
|
|
{ |
350
|
4 |
|
$this->isUseDefaultScopeField = false; |
351
|
|
|
|
352
|
4 |
|
return $this; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @inheritdoc |
357
|
|
|
*/ |
358
|
27 |
|
public function isScopeExcessAllowed(): bool |
359
|
|
|
{ |
360
|
27 |
|
return $this->isScopeExcessAllowedField; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @inheritdoc |
365
|
|
|
*/ |
366
|
1 |
|
public function enableScopeExcess(): ClientInterface |
367
|
|
|
{ |
368
|
1 |
|
$this->isScopeExcessAllowedField = true; |
369
|
|
|
|
370
|
1 |
|
return $this; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
/** |
374
|
|
|
* @inheritdoc |
375
|
|
|
*/ |
376
|
17 |
|
public function disableScopeExcess(): ClientInterface |
377
|
|
|
{ |
378
|
17 |
|
$this->isScopeExcessAllowedField = false; |
379
|
|
|
|
380
|
17 |
|
return $this; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* @inheritdoc |
385
|
|
|
*/ |
386
|
26 |
|
public function isCodeGrantEnabled(): bool |
387
|
|
|
{ |
388
|
26 |
|
return $this->isCodeAuthEnabledField; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* @inheritdoc |
393
|
|
|
*/ |
394
|
16 |
|
public function enableCodeGrant(): ClientInterface |
395
|
|
|
{ |
396
|
16 |
|
$this->isCodeAuthEnabledField = true; |
397
|
|
|
|
398
|
16 |
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* @inheritdoc |
403
|
|
|
*/ |
404
|
4 |
|
public function disableCodeGrant(): ClientInterface |
405
|
|
|
{ |
406
|
4 |
|
$this->isCodeAuthEnabledField = false; |
407
|
|
|
|
408
|
4 |
|
return $this; |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** |
412
|
|
|
* @inheritdoc |
413
|
|
|
*/ |
414
|
26 |
|
public function isImplicitGrantEnabled(): bool |
415
|
|
|
{ |
416
|
26 |
|
return $this->isImplicitAuthEnabledField; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* @inheritdoc |
421
|
|
|
*/ |
422
|
16 |
|
public function enableImplicitGrant(): ClientInterface |
423
|
|
|
{ |
424
|
16 |
|
$this->isImplicitAuthEnabledField = true; |
425
|
|
|
|
426
|
16 |
|
return $this; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* @inheritdoc |
431
|
|
|
*/ |
432
|
4 |
|
public function disableImplicitGrant(): ClientInterface |
433
|
|
|
{ |
434
|
4 |
|
$this->isImplicitAuthEnabledField = false; |
435
|
|
|
|
436
|
4 |
|
return $this; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @inheritdoc |
441
|
|
|
*/ |
442
|
26 |
|
public function isPasswordGrantEnabled(): bool |
443
|
|
|
{ |
444
|
26 |
|
return $this->isPasswordGrantEnabledField; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* @inheritdoc |
449
|
|
|
*/ |
450
|
18 |
|
public function enablePasswordGrant(): ClientInterface |
451
|
|
|
{ |
452
|
18 |
|
$this->isPasswordGrantEnabledField = true; |
453
|
|
|
|
454
|
18 |
|
return $this; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* @inheritdoc |
459
|
|
|
*/ |
460
|
3 |
|
public function disablePasswordGrant(): ClientInterface |
461
|
|
|
{ |
462
|
3 |
|
$this->isPasswordGrantEnabledField = false; |
463
|
|
|
|
464
|
3 |
|
return $this; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @inheritdoc |
469
|
|
|
*/ |
470
|
26 |
|
public function isClientGrantEnabled(): bool |
471
|
|
|
{ |
472
|
26 |
|
return $this->isClientGrantEnabledField; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
/** |
476
|
|
|
* @inheritdoc |
477
|
|
|
*/ |
478
|
1 |
|
public function enableClientGrant(): ClientInterface |
479
|
|
|
{ |
480
|
1 |
|
$this->isClientGrantEnabledField = true; |
481
|
|
|
|
482
|
1 |
|
return $this; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* @inheritdoc |
487
|
|
|
*/ |
488
|
17 |
|
public function disableClientGrant(): ClientInterface |
489
|
|
|
{ |
490
|
17 |
|
$this->isClientGrantEnabledField = false; |
491
|
|
|
|
492
|
17 |
|
return $this; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* @inheritdoc |
497
|
|
|
*/ |
498
|
25 |
|
public function isRefreshGrantEnabled(): bool |
499
|
|
|
{ |
500
|
25 |
|
return $this->isRefreshGrantEnabledField; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* @inheritdoc |
505
|
|
|
*/ |
506
|
16 |
|
public function enableRefreshGrant(): ClientInterface |
507
|
|
|
{ |
508
|
16 |
|
$this->isRefreshGrantEnabledField = true; |
509
|
|
|
|
510
|
16 |
|
return $this; |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* @inheritdoc |
515
|
|
|
*/ |
516
|
4 |
|
public function disableRefreshGrant(): ClientInterface |
517
|
|
|
{ |
518
|
4 |
|
$this->isRefreshGrantEnabledField = false; |
519
|
|
|
|
520
|
4 |
|
return $this; |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
/** |
524
|
|
|
* @inheritdoc |
525
|
|
|
*/ |
526
|
24 |
|
public function setCreatedAt(DateTimeInterface $createdAt): ClientInterface |
527
|
|
|
{ |
528
|
|
|
/** @var ClientInterface $self */ |
529
|
24 |
|
$self = $this->setCreatedAtImpl($createdAt); |
530
|
|
|
|
531
|
24 |
|
return $self; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* @inheritdoc |
536
|
|
|
*/ |
537
|
2 |
|
public function setUpdatedAt(DateTimeInterface $createdAt): ClientInterface |
538
|
|
|
{ |
539
|
|
|
/** @var ClientInterface $self */ |
540
|
2 |
|
$self = $this->setUpdatedAtImpl($createdAt); |
541
|
|
|
|
542
|
2 |
|
return $self; |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* @param string $value |
547
|
|
|
* |
548
|
|
|
* @return Client |
549
|
|
|
*/ |
550
|
17 |
|
protected function parseIsConfidential(string $value): Client |
551
|
|
|
{ |
552
|
17 |
|
$value === '1' ? $this->setConfidential() : $this->setPublic(); |
553
|
|
|
|
554
|
17 |
|
return $this; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* @param string $value |
559
|
|
|
* |
560
|
|
|
* @return Client |
561
|
|
|
*/ |
562
|
17 |
|
protected function parseIsUseDefaultScope(string $value): Client |
563
|
|
|
{ |
564
|
17 |
|
$value === '1' ? $this->useDefaultScopesOnEmptyRequest() : $this->doNotUseDefaultScopesOnEmptyRequest(); |
565
|
|
|
|
566
|
17 |
|
return $this; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* @param string $value |
571
|
|
|
* |
572
|
|
|
* @return Client |
573
|
|
|
*/ |
574
|
17 |
|
protected function parseIsScopeExcessAllowed(string $value): Client |
575
|
|
|
{ |
576
|
17 |
|
$value === '1' ? $this->enableScopeExcess() : $this->disableScopeExcess(); |
577
|
|
|
|
578
|
17 |
|
return $this; |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
/** |
582
|
|
|
* @param string $value |
583
|
|
|
* |
584
|
|
|
* @return Client |
585
|
|
|
*/ |
586
|
17 |
|
protected function parseIsCodeAuthEnabled(string $value): Client |
587
|
|
|
{ |
588
|
17 |
|
$value === '1' ? $this->enableCodeGrant() : $this->disableCodeGrant(); |
589
|
|
|
|
590
|
17 |
|
return $this; |
591
|
|
|
} |
592
|
|
|
|
593
|
|
|
/** |
594
|
|
|
* @param string $value |
595
|
|
|
* |
596
|
|
|
* @return Client |
597
|
|
|
*/ |
598
|
17 |
|
protected function parseIsImplicitAuthEnabled(string $value): Client |
599
|
|
|
{ |
600
|
17 |
|
$value === '1' ? $this->enableImplicitGrant() : $this->disableImplicitGrant(); |
601
|
|
|
|
602
|
17 |
|
return $this; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* @param string $value |
607
|
|
|
* |
608
|
|
|
* @return Client |
609
|
|
|
*/ |
610
|
17 |
|
protected function parseIsPasswordGrantEnabled(string $value): Client |
611
|
|
|
{ |
612
|
17 |
|
$value === '1' ? $this->enablePasswordGrant() : $this->disablePasswordGrant(); |
613
|
|
|
|
614
|
17 |
|
return $this; |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
/** |
618
|
|
|
* @param string $value |
619
|
|
|
* |
620
|
|
|
* @return Client |
621
|
|
|
*/ |
622
|
17 |
|
protected function parseIsClientGrantEnabled(string $value): Client |
623
|
|
|
{ |
624
|
17 |
|
$value === '1' ? $this->enableClientGrant() : $this->disableClientGrant(); |
625
|
|
|
|
626
|
17 |
|
return $this; |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* @param string $value |
631
|
|
|
* |
632
|
|
|
* @return Client |
633
|
|
|
*/ |
634
|
17 |
|
protected function parseIsRefreshGrantEnabled(string $value): Client |
635
|
|
|
{ |
636
|
17 |
|
$value === '1' ? $this->enableRefreshGrant() : $this->disableRefreshGrant(); |
637
|
|
|
|
638
|
17 |
|
return $this; |
639
|
|
|
} |
640
|
|
|
} |
641
|
|
|
|