mirror of
https://gitlab.com/izyim/prototypes/lumen-microservices/microservice-api-gateway.git
synced 2026-08-19 12:34:22 +00:00
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use Dusterio\LumenPassport\LumenPassport;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AuthServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Boot the authentication services for the application.
|
|
* If you desire to handle the request via simple mechanism
|
|
* $this->app['auth']->viaRequest('api', function ($request) {
|
|
* if ($request->input('api_token')) {
|
|
* return User::where('api_token', $request->input('api_token'))->first();
|
|
* }
|
|
* });
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
// Here you may define how you wish users to be authenticated for your Lumen
|
|
// application. The callback which receives the incoming request instance
|
|
// should return either a User instance or null. You're free to obtain
|
|
// the User instance via an API token or any other method necessary.
|
|
|
|
LumenPassport::routes($this->app->router);
|
|
}
|
|
}
|