Skip to content

Commit

Permalink
Merge pull request #16 from sympla/task/lumen-provider
Browse files Browse the repository at this point in the history
Add ServiceProvider for lumen
  • Loading branch information
pedroigorsilva authored May 23, 2019
2 parents 6e58491 + ed0daa4 commit eb1bb88
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Lumen/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Sympla\Auth\Lumen;

use Sympla\Auth\Laravel\OAuthUserProvider;
use Sympla\Auth\Laravel\ServiceProvider as LumenServiceProvider;

class ServiceProvider extends LumenServiceProvider
{
public function boot()
{
$this->publishes([$this->configPath() => $this->appConfigPath('sympla.php')]);

$auth = $this->app->make('auth');

$auth->provider('oauth', function ($app, array $config) {
return new OAuthUserProvider(
$app->make('sympla.oauth.password_client'),
$config,
$app->make('request')
);
});
}

protected function appConfigPath($path)
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}

0 comments on commit eb1bb88

Please sign in to comment.