|
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 |
|
13
|
|
|
* @package OAuth2\Extensions\PKCE\Credentials |
|
14
|
|
|
*/ |
|
15
|
|
|
class AuthorizationCode extends \OAuth2\Credentials\AuthorizationCode implements AuthorizationCodeInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @var string|null |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $codeChallenge; |
|
21
|
|
|
/** |
|
22
|
|
|
* @var string|null |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $codeChallengeMethod; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct(string $code, array $scopes, string $clientIdentifier, string $resourceOwnerIdentifier, |
|
27
|
|
|
\DateTimeInterface $expiresAt, ?array $requestedScopes = null, ?string $redirectUri = null, |
|
28
|
|
|
?string $codeChallenge = null, ?string $codeChallengeMethod = null) |
|
29
|
|
|
{ |
|
30
|
|
|
parent::__construct($code, $scopes, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScopes, $redirectUri); |
|
31
|
|
|
$this->codeChallenge = $codeChallenge; |
|
32
|
|
|
$this->codeChallengeMethod = $codeChallengeMethod; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return null|string |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getCodeChallenge(): ?string |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->codeChallenge; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param null|string $codeChallenge |
|
45
|
|
|
*/ |
|
46
|
|
|
public function setCodeChallenge(?string $codeChallenge): void |
|
47
|
|
|
{ |
|
48
|
|
|
$this->codeChallenge = $codeChallenge; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return null|string |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getCodeChallengeMethod(): ?string |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->codeChallengeMethod; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param null|string $codeChallengeMethod |
|
61
|
|
|
*/ |
|
62
|
|
|
public function setCodeChallengeMethod(?string $codeChallengeMethod): void |
|
63
|
|
|
{ |
|
64
|
|
|
$this->codeChallengeMethod = $codeChallengeMethod; |
|
65
|
|
|
} |
|
66
|
|
|
} |