| @@ 16-59 (lines=44) @@ | ||
| 13 | use Nord\Lumen\OAuth2\Eloquent\Storages\ScopeStorage; |
|
| 14 | use Nord\Lumen\OAuth2\Eloquent\Storages\SessionStorage; |
|
| 15 | ||
| 16 | class EloquentServiceProvider extends ServiceProvider |
|
| 17 | { |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @inheritdoc |
|
| 21 | */ |
|
| 22 | public function register() |
|
| 23 | { |
|
| 24 | $this->registerContainerBindings($this->app); |
|
| 25 | } |
|
| 26 | ||
| 27 | ||
| 28 | /** |
|
| 29 | * |
|
| 30 | */ |
|
| 31 | protected function registerContainerBindings(Container $container) |
|
| 32 | { |
|
| 33 | $container->bind(AccessTokenStorage::class, function () { |
|
| 34 | return new AccessTokenStorage; |
|
| 35 | }); |
|
| 36 | ||
| 37 | $container->bind(ClientStorage::class, function () { |
|
| 38 | return new ClientStorage; |
|
| 39 | }); |
|
| 40 | ||
| 41 | $container->bind(RefreshTokenStorage::class, function () { |
|
| 42 | return new RefreshTokenStorage; |
|
| 43 | }); |
|
| 44 | ||
| 45 | $container->bind(ScopeStorage::class, function () { |
|
| 46 | return new ScopeStorage; |
|
| 47 | }); |
|
| 48 | ||
| 49 | $container->bind(SessionStorage::class, function () { |
|
| 50 | return new SessionStorage; |
|
| 51 | }); |
|
| 52 | ||
| 53 | $container->bind(AccessTokenInterface::class, AccessTokenStorage::class); |
|
| 54 | $container->bind(ClientInterface::class, ClientStorage::class); |
|
| 55 | $container->bind(RefreshTokenInterface::class, RefreshTokenStorage::class); |
|
| 56 | $container->bind(ScopeInterface::class, ScopeStorage::class); |
|
| 57 | $container->bind(SessionInterface::class, SessionStorage::class); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 17-58 (lines=42) @@ | ||
| 14 | use League\OAuth2\Server\Storage\ScopeInterface; |
|
| 15 | use League\OAuth2\Server\Storage\SessionInterface; |
|
| 16 | ||
| 17 | class MockStorageServiceProvider extends ServiceProvider |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @inheritdoc |
|
| 21 | */ |
|
| 22 | public function register() |
|
| 23 | { |
|
| 24 | $this->registerContainerBindings($this->app); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * |
|
| 29 | */ |
|
| 30 | protected function registerContainerBindings(Container $container) |
|
| 31 | { |
|
| 32 | $container->bind(MockAccessTokenStorage::class, function () { |
|
| 33 | return new MockAccessTokenStorage; |
|
| 34 | }); |
|
| 35 | ||
| 36 | $container->bind( MockClientStorage::class, function () { |
|
| 37 | return new MockClientStorage; |
|
| 38 | }); |
|
| 39 | ||
| 40 | $container->bind(MockRefreshTokenStorage::class, function () { |
|
| 41 | return new MockRefreshTokenStorage; |
|
| 42 | }); |
|
| 43 | ||
| 44 | $container->bind(MockScopeStorage::class, function () { |
|
| 45 | return new MockScopeStorage; |
|
| 46 | }); |
|
| 47 | ||
| 48 | $container->bind(MockSessionStorage::class, function () { |
|
| 49 | return new MockSessionStorage; |
|
| 50 | }); |
|
| 51 | ||
| 52 | $container->bind(AccessTokenInterface::class, MockAccessTokenStorage::class); |
|
| 53 | $container->bind(ClientInterface::class, MockClientStorage::class); |
|
| 54 | $container->bind(RefreshTokenInterface::class, MockRefreshTokenStorage::class); |
|
| 55 | $container->bind(ScopeInterface::class, MockScopeStorage::class); |
|
| 56 | $container->bind(SessionInterface::class, MockSessionStorage::class); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||