Skip to content
This repository was archived by the owner on Feb 26, 2018. It is now read-only.

Commit dc15638

Browse files
committed
Resolve identity store out of IOC
1 parent 4a00e60 commit dc15638

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/EloquentOAuthServiceProvider.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use SocialNorm\Request;
88
use SocialNorm\StateGenerator;
99
use AdamWathan\EloquentOAuth\Authenticator;
10+
use AdamWathan\EloquentOAuth\EloquentIdentityStore;
1011
use AdamWathan\EloquentOAuth\IdentityStore;
1112
use AdamWathan\EloquentOAuth\Session;
1213
use AdamWathan\EloquentOAuth\OAuthIdentity;
@@ -39,10 +40,18 @@ class EloquentOAuthServiceProvider extends ServiceProvider {
3940
public function register()
4041
{
4142
$this->configureOAuthIdentitiesTable();
43+
$this->registerIdentityStore();
4244
$this->registerOAuthManager();
4345
$this->registerCommands();
4446
}
4547

48+
protected function registerIdentityStore()
49+
{
50+
$this->app->singleton('AdamWathan\EloquentOAuth\IdentityStore', function ($app) {
51+
return new EloquentIdentityStore;
52+
});
53+
}
54+
4655
protected function registerOAuthManager()
4756
{
4857
$this->app['adamwathan.oauth'] = $this->app->share(function ($app) {
@@ -54,7 +63,12 @@ protected function registerOAuthManager()
5463
$this->registerProviders($socialnorm, $request);
5564

5665
$users = new UserStore($app['config']['auth.model']);
57-
$authenticator = new Authenticator($app['Illuminate\Contracts\Auth\Guard'], $users, new IdentityStore);
66+
67+
$authenticator = new Authenticator(
68+
$app['Illuminate\Contracts\Auth\Guard'],
69+
$users,
70+
$app['AdamWathan\EloquentOAuth\IdentityStore']
71+
);
5872

5973
$oauth = new OAuthManager($app['redirect'], $authenticator, $socialnorm);
6074
return $oauth;

0 commit comments

Comments
 (0)