-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
750 additions
and
784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use App\User; | ||
use Illuminate\Support\Facades\Gate; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class AuthServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Boot the authentication services for the application. | ||
* | ||
* @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. | ||
|
||
$this->app['auth']->viaRequest('api', function ($request) { | ||
if ($request->input('api_token')) { | ||
return User::where('api_token', $request->input('api_token'))->first(); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.