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

Commit

Permalink
Resolve identity store out of IOC
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Jun 10, 2015
1 parent 4a00e60 commit dc15638
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/EloquentOAuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SocialNorm\Request;
use SocialNorm\StateGenerator;
use AdamWathan\EloquentOAuth\Authenticator;
use AdamWathan\EloquentOAuth\EloquentIdentityStore;
use AdamWathan\EloquentOAuth\IdentityStore;
use AdamWathan\EloquentOAuth\Session;
use AdamWathan\EloquentOAuth\OAuthIdentity;
Expand Down Expand Up @@ -39,10 +40,18 @@ class EloquentOAuthServiceProvider extends ServiceProvider {
public function register()
{
$this->configureOAuthIdentitiesTable();
$this->registerIdentityStore();
$this->registerOAuthManager();
$this->registerCommands();
}

protected function registerIdentityStore()
{
$this->app->singleton('AdamWathan\EloquentOAuth\IdentityStore', function ($app) {
return new EloquentIdentityStore;
});
}

protected function registerOAuthManager()
{
$this->app['adamwathan.oauth'] = $this->app->share(function ($app) {
Expand All @@ -54,7 +63,12 @@ protected function registerOAuthManager()
$this->registerProviders($socialnorm, $request);

$users = new UserStore($app['config']['auth.model']);
$authenticator = new Authenticator($app['Illuminate\Contracts\Auth\Guard'], $users, new IdentityStore);

$authenticator = new Authenticator(
$app['Illuminate\Contracts\Auth\Guard'],
$users,
$app['AdamWathan\EloquentOAuth\IdentityStore']
);

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

0 comments on commit dc15638

Please sign in to comment.