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 ResourceOwnerStorageInterface |
20
|
|
|
*/ |
21
|
|
|
private $resourceOwnerStorage; |
22
|
|
|
/** |
23
|
|
|
* @var AuthorizationCodeStorageInterface |
24
|
|
|
*/ |
25
|
|
|
private $authorizationCodeStorage; |
26
|
|
|
/** |
27
|
|
|
* @var AccessTokenStorageInterface |
28
|
|
|
*/ |
29
|
|
|
private $accessTokenStorage; |
30
|
|
|
/** |
31
|
|
|
* @var RefreshTokenStorageInterface |
32
|
|
|
*/ |
33
|
|
|
private $refreshTokenStorage; |
34
|
|
|
|
35
|
|
|
public function __construct( |
36
|
|
|
ClientStorageInterface $clientStorage, |
37
|
|
|
ResourceOwnerStorageInterface $resourceOwnerStorage, |
38
|
|
|
AuthorizationCodeStorageInterface $authorizationCodeStorage, |
39
|
|
|
AccessTokenStorageInterface $accessTokenStorage, |
40
|
|
|
RefreshTokenStorageInterface $refreshTokenStorage) |
41
|
|
|
{ |
42
|
|
|
$this->clientStorage = $clientStorage; |
43
|
|
|
$this->resourceOwnerStorage = $resourceOwnerStorage; |
44
|
|
|
$this->authorizationCodeStorage = $authorizationCodeStorage; |
45
|
|
|
$this->accessTokenStorage = $accessTokenStorage; |
46
|
|
|
$this->refreshTokenStorage = $refreshTokenStorage; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return ClientStorageInterface |
51
|
|
|
*/ |
52
|
|
|
public function getClientStorage(): ClientStorageInterface |
53
|
|
|
{ |
54
|
|
|
return $this->clientStorage; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return ResourceOwnerStorageInterface |
59
|
|
|
*/ |
60
|
|
|
public function getResourceOwnerStorage(): ResourceOwnerStorageInterface |
61
|
|
|
{ |
62
|
|
|
return $this->resourceOwnerStorage; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return AuthorizationCodeStorageInterface |
67
|
|
|
*/ |
68
|
|
|
public function getAuthorizationCodeStorage(): AuthorizationCodeStorageInterface |
69
|
|
|
{ |
70
|
|
|
return $this->authorizationCodeStorage; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return AccessTokenStorageInterface |
75
|
|
|
*/ |
76
|
|
|
public function getAccessTokenStorage(): AccessTokenStorageInterface |
77
|
|
|
{ |
78
|
|
|
return $this->accessTokenStorage; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return RefreshTokenStorageInterface |
83
|
|
|
*/ |
84
|
|
|
public function getRefreshTokenStorage(): RefreshTokenStorageInterface |
85
|
|
|
{ |
86
|
|
|
return $this->refreshTokenStorage; |
87
|
|
|
} |
88
|
|
|
} |