]> BookStack Code Mirror - bookstack/blob - app/Providers/AuthServiceProvider.php
Add Perl syntax higlighting to code editor
[bookstack] / app / Providers / AuthServiceProvider.php
1 <?php
2
3 namespace BookStack\Providers;
4
5 use Auth;
6 use BookStack\Api\ApiTokenGuard;
7 use BookStack\Auth\Access\LdapService;
8 use Illuminate\Support\ServiceProvider;
9
10 class AuthServiceProvider extends ServiceProvider
11 {
12     /**
13      * Bootstrap the application services.
14      *
15      * @return void
16      */
17     public function boot()
18     {
19         Auth::extend('api-token', function ($app, $name, array $config) {
20             return new ApiTokenGuard($app['request']);
21         });
22     }
23
24     /**
25      * Register the application services.
26      *
27      * @return void
28      */
29     public function register()
30     {
31         Auth::provider('ldap', function ($app, array $config) {
32             return new LdapUserProvider($config['model'], $app[LdapService::class]);
33         });
34     }
35 }