Add support for 2 Factor Authentification (2FA)

This commit is contained in:
DariusIII
2020-12-28 01:32:20 +01:00
parent 6c621f9fb4
commit fa3ded8b41
24 changed files with 1181 additions and 20 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use App\Support\Google2FAAuthenticator;
use Closure;
class Google2FAMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$authenticator = app(Google2FAAuthenticator::class)->boot($request);
if ($authenticator->isAuthenticated()) {
return $next($request);
}
return $authenticator->makeRequestOneTimePasswordResponse();
}
}