1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: Alexandre |
5
|
|
|
* Date: 11/03/2018 |
6
|
|
|
* Time: 18:20 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace OAuth2\Storages; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StorageManager |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var ClientStorageInterface |
16
|
|
|
*/ |
17
|
|
|
private $clientStorage; |
18
|
|
|
/** |
19
|
|
|
* @var AuthorizationCodeStorageInterface |
20
|
|
|
*/ |
21
|
|
|
private $authorizationCodeStorage; |
22
|
|
|
/** |
23
|
|
|
* @var AccessTokenStorageInterface |
24
|
|
|
*/ |
25
|
|
|
private $accessTokenStorage; |
26
|
|
|
/** |
27
|
|
|
* @var RefreshTokenStorageInterface |
28
|
|
|
*/ |
29
|
|
|
private $refreshTokenStorage; |
30
|
|
|
|
31
|
|
|
public function __construct( |
32
|
|
|
ClientStorageInterface $clientStorage, |
33
|
|
|
AuthorizationCodeStorageInterface $authorizationCodeStorage, |
34
|
|
|
AccessTokenStorageInterface $accessTokenStorage, |
35
|
|
|
RefreshTokenStorageInterface $refreshTokenStorage) |
36
|
|
|
{ |
37
|
|
|
$this->clientStorage = $clientStorage; |
38
|
|
|
$this->authorizationCodeStorage = $authorizationCodeStorage; |
39
|
|
|
$this->accessTokenStorage = $accessTokenStorage; |
40
|
|
|
$this->refreshTokenStorage = $refreshTokenStorage; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return ClientStorageInterface |
45
|
|
|
*/ |
46
|
|
|
public function getClientStorage(): ClientStorageInterface |
47
|
|
|
{ |
48
|
|
|
return $this->clientStorage; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return AuthorizationCodeStorageInterface |
53
|
|
|
*/ |
54
|
|
|
public function getAuthorizationCodeStorage(): AuthorizationCodeStorageInterface |
55
|
|
|
{ |
56
|
|
|
return $this->authorizationCodeStorage; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return AccessTokenStorageInterface |
61
|
|
|
*/ |
62
|
|
|
public function getAccessTokenStorage(): AccessTokenStorageInterface |
63
|
|
|
{ |
64
|
|
|
return $this->accessTokenStorage; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return RefreshTokenStorageInterface |
69
|
|
|
*/ |
70
|
|
|
public function getRefreshTokenStorage(): RefreshTokenStorageInterface |
71
|
|
|
{ |
72
|
|
|
return $this->refreshTokenStorage; |
73
|
|
|
} |
74
|
|
|
} |