@@ -89,18 +89,20 @@ protected function setupMigrations(Application $app)
89
89
*/
90
90
public function register ()
91
91
{
92
- $ this ->registerAuthorizer ();
93
- $ this ->registerMiddlewareBindings ();
92
+ $ this ->registerAuthorizer ($ this -> app );
93
+ $ this ->registerMiddlewareBindings ($ this -> app );
94
94
}
95
95
96
96
/**
97
97
* Register the Authorization server with the IoC container.
98
98
*
99
+ * @param \Illuminate\Contracts\Foundation\Application $app
100
+ *
99
101
* @return void
100
102
*/
101
- public function registerAuthorizer ()
103
+ public function registerAuthorizer (Application $ app )
102
104
{
103
- $ this -> app ->bindShared ('oauth2-server.authorizer ' , function ($ app ) {
105
+ $ app ->singleton ('oauth2-server.authorizer ' , function ($ app ) {
104
106
$ config = $ app ['config ' ]->get ('oauth2 ' );
105
107
$ issuer = $ app ->make (AuthorizationServer::class)
106
108
->setClientStorage ($ app ->make (ClientInterface::class))
@@ -152,34 +154,34 @@ public function registerAuthorizer()
152
154
return $ authorizer ;
153
155
});
154
156
155
- $ this ->app ->bind (Authorizer::class, function ($ app ) {
156
- return $ app ['oauth2-server.authorizer ' ];
157
- });
157
+ $ app ->alias ('oauth2-server.authorizer ' , Authorizer::class);
158
158
}
159
159
160
160
/**
161
161
* Register the Middleware to the IoC container because
162
162
* some middleware need additional parameters.
163
163
*
164
+ * @param \Illuminate\Contracts\Foundation\Application $app
165
+ *
164
166
* @return void
165
167
*/
166
- public function registerMiddlewareBindings ()
168
+ public function registerMiddlewareBindings (Application $ app )
167
169
{
168
- $ this -> app ->bindShared (CheckAuthCodeRequestMiddleware::class, function ($ app ) {
170
+ $ app ->singleton (CheckAuthCodeRequestMiddleware::class, function ($ app ) {
169
171
return new CheckAuthCodeRequestMiddleware ($ app ['oauth2-server.authorizer ' ]);
170
172
});
171
173
172
- $ this -> app ->bindShared (OAuthMiddleware::class, function ($ app ) {
174
+ $ app ->singleton (OAuthMiddleware::class, function ($ app ) {
173
175
$ httpHeadersOnly = $ app ['config ' ]->get ('oauth2.http_headers_only ' );
174
176
175
177
return new OAuthMiddleware ($ app ['oauth2-server.authorizer ' ], $ httpHeadersOnly );
176
178
});
177
179
178
- $ this -> app ->bindShared (OAuthClientOwnerMiddleware::class, function ($ app ) {
180
+ $ app ->singleton (OAuthClientOwnerMiddleware::class, function ($ app ) {
179
181
return new OAuthClientOwnerMiddleware ($ app ['oauth2-server.authorizer ' ]);
180
182
});
181
183
182
- $ this -> app ->bindShared (OAuthUserOwnerMiddleware::class, function ($ app ) {
184
+ $ app ->singleton (OAuthUserOwnerMiddleware::class, function ($ app ) {
183
185
return new OAuthUserOwnerMiddleware ($ app ['oauth2-server.authorizer ' ]);
184
186
});
185
187
}
0 commit comments