/** * @author LAHAXE Arnaud * * @return mixed */ public function authData() { if ($this->u2f->check()) { return $this->redirectAfterSuccessAuth(); } $req = $this->u2f->getAuthenticateData(Auth::user()); Event::fire('u2f.authentication.data', ['user' => Auth::user()]); Session::set('u2f.authenticationData', $req); return view($this->config->get('u2f.authenticate.view'))->with('authenticationData', $req); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if (!$this->config->get('u2f.enable')) { return $next($request); } if (!$this->u2f->check()) { if (Auth::guest()) { throw new HttpException(401, 'You need to log in before an u2f authentication'); } if (U2fKey::where('user_id', '=', Auth::user()->id)->count() === 0 && $this->config->get('u2f.byPassUserWithoutKey')) { return $next($request); } return redirect()->guest('u2f/auth'); } return $next($request); }