1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: Alexandre |
5
|
|
|
* Date: 07/03/2018 |
6
|
|
|
* Time: 21:57 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace OAuth2\Extensions\PKCE\Credentials; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class AuthorizationCode extends \OAuth2\Credentials\AuthorizationCode |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var string|null |
16
|
|
|
*/ |
17
|
|
|
protected $codeChallenge; |
18
|
|
|
/** |
19
|
|
|
* @var string|null |
20
|
|
|
*/ |
21
|
|
|
protected $codeChallengeMethod; |
22
|
|
|
|
23
|
|
|
public function __construct(string $code, string $scope, string $clientIdentifier, string $resourceOwnerIdentifier, |
24
|
|
|
int $expiresAt, ?string $requestedScope = null, ?string $redirectUri = null, |
25
|
|
|
?string $codeChallenge = null, ?string $codeChallengeMethod = null) |
26
|
|
|
{ |
27
|
|
|
parent::__construct($code, $scope, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScope, $redirectUri); |
28
|
|
|
$this->codeChallenge = $codeChallenge; |
29
|
|
|
$this->codeChallengeMethod = $codeChallengeMethod; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return null|string |
34
|
|
|
*/ |
35
|
|
|
public function getCodeChallenge(): ?string |
36
|
|
|
{ |
37
|
|
|
return $this->codeChallenge; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param null|string $codeChallenge |
42
|
|
|
*/ |
43
|
|
|
public function setCodeChallenge(?string $codeChallenge): void |
44
|
|
|
{ |
45
|
|
|
$this->codeChallenge = $codeChallenge; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return null|string |
50
|
|
|
*/ |
51
|
|
|
public function getCodeChallengeMethod(): ?string |
52
|
|
|
{ |
53
|
|
|
return $this->codeChallengeMethod; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param null|string $codeChallengeMethod |
58
|
|
|
*/ |
59
|
|
|
public function setCodeChallengeMethod(?string $codeChallengeMethod): void |
60
|
|
|
{ |
61
|
|
|
$this->codeChallengeMethod = $codeChallengeMethod; |
62
|
|
|
} |
63
|
|
|
} |