mirror of
https://github.com/devfake/flox.git
synced 2024-11-15 14:42:31 +01:00
498d7baa51
* Update vagrantfile * Add http basic auth * Add new api for FP to call * refactor
25 lines
595 B
PHP
25 lines
595 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
class HttpBasicAuth
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, $next)
|
|
{
|
|
if($request->getUser() == config('auth.HTTP_BASIC_USERNAME') && $request->getPassword() == config('auth.HTTP_BASIC_PASSWORD')) {
|
|
return $next($request);
|
|
}
|
|
|
|
return response('Invalid credentials.', Response::HTTP_UNAUTHORIZED, ['WWW-Authenticate' => 'Basic']);
|
|
}
|
|
}
|