Handle missing daemon keys better and fix subuser missing key errors

This commit is contained in:
Dane Everitt 2018-03-03 21:31:44 -06:00
parent 18e394eb14
commit a4f03f5d02
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 74 additions and 49 deletions

View file

@ -11,7 +11,6 @@ namespace Pterodactyl\Http\Middleware\Server;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Contracts\Session\Session;
use Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@ -23,21 +22,14 @@ class AuthenticateAsSubuser
*/
private $keyProviderService;
/**
* @var \Illuminate\Contracts\Session\Session
*/
private $session;
/**
* SubuserAccessAuthenticate constructor.
*
* @param \Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService $keyProviderService
* @param \Illuminate\Contracts\Session\Session $session
*/
public function __construct(DaemonKeyProviderService $keyProviderService, Session $session)
public function __construct(DaemonKeyProviderService $keyProviderService)
{
$this->keyProviderService = $keyProviderService;
$this->session = $session;
}
/**
@ -60,7 +52,6 @@ class AuthenticateAsSubuser
throw new AccessDeniedHttpException('This account does not have permission to access this server.');
}
$this->session->now('server_data.token', $token);
$request->attributes->set('server_token', $token);
return $next($request);