From ed0daa4949ae8df3003c1cb99f6025e4e944e4f6 Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Thu, 23 May 2019 17:06:15 -0300 Subject: [PATCH] Add ServiceProvider for lumen --- src/Lumen/ServiceProvider.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Lumen/ServiceProvider.php diff --git a/src/Lumen/ServiceProvider.php b/src/Lumen/ServiceProvider.php new file mode 100644 index 0000000..a29073e --- /dev/null +++ b/src/Lumen/ServiceProvider.php @@ -0,0 +1,29 @@ +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); + } +}