Move initial check of bearer token into a middleware

This commit is contained in:
Jonny Barnes 2017-03-24 15:40:36 +00:00
parent b4ddbbdf8b
commit 9c9d8bcd50
4 changed files with 205 additions and 220 deletions

View file

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
class VerifyMicropubToken
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->bearerToken() === null) {
abort(401);
}
return $next($request);
}
}