Obliterate JWT from codebase
This commit is contained in:
parent
6336e5191f
commit
550c622d3b
8 changed files with 3 additions and 125 deletions
|
@ -13,13 +13,12 @@ use Pterodactyl\Http\Controllers\Controller;
|
|||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Pterodactyl\Traits\Helpers\ProvidesJWTServices;
|
||||
use Illuminate\Contracts\Cache\Repository as CacheRepository;
|
||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||
|
||||
abstract class AbstractLoginController extends Controller
|
||||
{
|
||||
use AuthenticatesUsers, ProvidesJWTServices;
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Auth\AuthManager
|
||||
|
|
|
@ -9,7 +9,6 @@ use Pterodactyl\Models\User;
|
|||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Auth\AuthManager;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Pterodactyl\Traits\Helpers\ProvidesJWTServices;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
|
||||
|
@ -17,8 +16,6 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
|||
|
||||
class AuthenticateKey
|
||||
{
|
||||
use ProvidesJWTServices;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Auth\AuthManager
|
||||
*/
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Traits\Helpers;
|
||||
|
||||
use Lcobucci\JWT\Signer;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait ProvidesJWTServices
|
||||
{
|
||||
/**
|
||||
* Get the signing key to use when creating JWTs.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getJWTSigningKey(): string
|
||||
{
|
||||
$key = config()->get('jwt.key', '');
|
||||
if (Str::startsWith($key, 'base64:')) {
|
||||
$key = base64_decode(substr($key, 7));
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide the signing algo to use for JWT.
|
||||
*
|
||||
* @return \Lcobucci\JWT\Signer
|
||||
*/
|
||||
public function getJWTSigner(): Signer
|
||||
{
|
||||
$class = config()->get('jwt.signer');
|
||||
|
||||
return new $class;
|
||||
}
|
||||
}
|
Reference in a new issue