<?php namespace GermanAirlinesVa\Graphql\Classes;

use Closure;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class Authentication
{
  /**
   * Handle an incoming request.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  \Closure  $next
   * @return mixed
   */
  public function handle($request, Closure $next)
  {
    if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') {
      return "";
    }
    else {
      throw new AccessDeniedHttpException;
    }

    return $next($request);
  }
}
