Skip to content

Commit c87fc6b

Browse files
committed
Merge pull request #97 from stephenfrank/patch-1
Change "require_once" to "require" so that filters get applied on multiple application boots during unit tests
2 parents 4423e33 + 285bdd6 commit c87fc6b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/LucaDegasperi/OAuth2Server/OAuth2ServerServiceProvider.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ public function boot()
2222
{
2323
$this->package('lucadegasperi/oauth2-server-laravel', 'lucadegasperi/oauth2-server-laravel');
2424

25-
require_once __DIR__.'/../../filters.php';
25+
/** @var \Illuminate\Routing\Router $router */
26+
$router = $this->app['router'];
27+
28+
// Bind a filter to check if the auth code grant type params are provided
29+
$router->filter('check-authorization-params', 'LucaDegasperi\OAuth2Server\Filters\CheckAuthorizationParamsFilter');
30+
31+
// Bind a filter to make sure that an endpoint is accessible only by authorized members eventually with specific scopes
32+
$router->filter('oauth', 'LucaDegasperi\OAuth2Server\Filters\OAuthFilter');
33+
34+
// Bind a filter to make sure that an endpoint is accessible only by a specific owner
35+
$router->filter('oauth-owner', 'LucaDegasperi\OAuth2Server\Filters\OAuthOwnerFilter');
2636
}
2737

2838
/**

src/filters.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)