77use SocialNorm \Request ;
88use SocialNorm \StateGenerator ;
99use AdamWathan \EloquentOAuth \Authenticator ;
10+ use AdamWathan \EloquentOAuth \EloquentIdentityStore ;
1011use AdamWathan \EloquentOAuth \IdentityStore ;
1112use AdamWathan \EloquentOAuth \Session ;
1213use 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