|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Nord\Lumen\OAuth2\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Contracts\Container\Container; |
|
6
|
|
|
use Illuminate\Support\ServiceProvider; |
|
7
|
|
|
use League\OAuth2\Server\Storage\AccessTokenInterface; |
|
8
|
|
|
use League\OAuth2\Server\Storage\ClientInterface; |
|
9
|
|
|
use League\OAuth2\Server\Storage\RefreshTokenInterface; |
|
10
|
|
|
use League\OAuth2\Server\Storage\ScopeInterface; |
|
11
|
|
|
use League\OAuth2\Server\Storage\SessionInterface; |
|
12
|
|
|
|
|
13
|
|
|
class MockStorageServiceProvider extends ServiceProvider |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @inheritdoc |
|
17
|
|
|
*/ |
|
18
|
|
|
public function register() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->registerContainerBindings($this->app); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* |
|
25
|
|
|
*/ |
|
26
|
|
|
protected function registerContainerBindings(Container $container) |
|
27
|
|
|
{ |
|
28
|
|
|
$container->bind(MockAccessTokenStorage::class, function () { |
|
29
|
|
|
return new MockAccessTokenStorage; |
|
30
|
|
|
}); |
|
31
|
|
|
|
|
32
|
|
|
$container->bind(MockClientStorage::class, function () { |
|
33
|
|
|
return new MockClientStorage; |
|
34
|
|
|
}); |
|
35
|
|
|
|
|
36
|
|
|
$container->bind(MockRefreshTokenStorage::class, function () { |
|
37
|
|
|
return new MockRefreshTokenStorage; |
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
$container->bind(MockScopeStorage::class, function () { |
|
41
|
|
|
return new MockScopeStorage; |
|
42
|
|
|
}); |
|
43
|
|
|
|
|
44
|
|
|
$container->bind(MockSessionStorage::class, function () { |
|
45
|
|
|
return new MockSessionStorage; |
|
46
|
|
|
}); |
|
47
|
|
|
|
|
48
|
|
|
$container->bind(AccessTokenInterface::class, MockAccessTokenStorage::class); |
|
49
|
|
|
$container->bind(ClientInterface::class, MockClientStorage::class); |
|
50
|
|
|
$container->bind(RefreshTokenInterface::class, MockRefreshTokenStorage::class); |
|
51
|
|
|
$container->bind(ScopeInterface::class, MockScopeStorage::class); |
|
52
|
|
|
$container->bind(SessionInterface::class, MockSessionStorage::class); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|