Ejemplo n.º 1
0
 /**
  * Handle an incoming request and check that the user token has been given in the Request's headers
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Checking the X-Auth-Token parameter from the header to see if the user is authenticated
     if (\App\Services\UserToken::checkAndAuthToken($request)) {
         return $next($request);
     } else {
         //Authentication failed for some reason
         $service = new \App\Http\Controllers\WebServices([]);
         return $service->respondForbidden();
     }
 }
Ejemplo n.º 2
0
 public function getToken()
 {
     return \App\Services\UserToken::getToken();
 }