API key UI changes and backend storage of the keys

This commit is contained in:
Dane Everitt 2017-11-19 13:32:17 -06:00
parent 69e67b5e2d
commit 47e14ccaae
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
11 changed files with 136 additions and 160 deletions

View file

@ -0,0 +1,40 @@
<?php
namespace Pterodactyl\Http\Middleware\API;
use Closure;
use Illuminate\Http\Request;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
class AuthenticateKey
{
/**
* @var \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface
*/
private $repository;
/**
* AuthenticateKey constructor.
*
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
*/
public function __construct(ApiKeyRepositoryInterface $repository)
{
$this->repository = $repository;
}
/**
* Handle an API request by verifying that the provided API key
* is in a valid format, and the route being accessed is allowed
* for the given key.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*/
public function handle(Request $request, Closure $next)
{
$this->repository->findFirstWhere([
'',
]);
}
}