3 namespace BookStack\Providers;
6 use BookStack\Api\ApiTokenGuard;
7 use BookStack\Auth\Access\ExternalBaseUserProvider;
8 use BookStack\Auth\Access\Guards\LdapSessionGuard;
9 use BookStack\Auth\Access\LdapService;
10 use BookStack\Auth\UserRepo;
11 use Illuminate\Support\ServiceProvider;
13 class AuthServiceProvider extends ServiceProvider
16 * Bootstrap the application services.
20 public function boot()
22 Auth::extend('api-token', function ($app, $name, array $config) {
23 return new ApiTokenGuard($app['request']);
26 Auth::extend('ldap-session', function ($app, $name, array $config) {
27 $provider = Auth::createUserProvider($config['provider']);
28 return new LdapSessionGuard(
31 $this->app['session.store'],
32 $app[LdapService::class],
39 * Register the application services.
43 public function register()
45 Auth::provider('external-users', function ($app, array $config) {
46 return new ExternalBaseUserProvider($config['model']);