From 550c622d3bf51bf6203b39df4b775a4e95c892a3 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 14 Jul 2018 22:48:09 -0700 Subject: [PATCH] Obliterate JWT from codebase --- .../Auth/AbstractLoginController.php | 3 +- app/Http/Middleware/Api/AuthenticateKey.php | 3 - app/Traits/Helpers/ProvidesJWTServices.php | 36 ----------- composer.json | 1 - composer.lock | 62 +------------------ config/jwt.php | 18 ------ package.json | 1 - yarn.lock | 4 -- 8 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 app/Traits/Helpers/ProvidesJWTServices.php delete mode 100644 config/jwt.php diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index 199ecac8..b15e90b4 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -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 diff --git a/app/Http/Middleware/Api/AuthenticateKey.php b/app/Http/Middleware/Api/AuthenticateKey.php index ed3ed1b1..591aeef9 100644 --- a/app/Http/Middleware/Api/AuthenticateKey.php +++ b/app/Http/Middleware/Api/AuthenticateKey.php @@ -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 */ diff --git a/app/Traits/Helpers/ProvidesJWTServices.php b/app/Traits/Helpers/ProvidesJWTServices.php deleted file mode 100644 index 1c5726fb..00000000 --- a/app/Traits/Helpers/ProvidesJWTServices.php +++ /dev/null @@ -1,36 +0,0 @@ -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; - } -} diff --git a/composer.json b/composer.json index 1d5e3a94..4f199060 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,6 @@ "laracasts/utilities": "^3.0", "laravel/framework": "5.6.*", "laravel/tinker": "^1.0", - "lcobucci/jwt": "^3.2", "lord/laroute": "^2.4", "matriphe/iso-639": "^1.2", "nesbot/carbon": "^1.22", diff --git a/composer.lock b/composer.lock index 3126a7eb..fe43e147 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "069ebb3ec35c8b309b129189106ad45a", + "content-hash": "9055a451d415d482a2f7287e0787bbc3", "packages": [ { "name": "appstract/laravel-blade-directives", @@ -1569,64 +1569,6 @@ ], "time": "2018-05-17T13:42:07+00:00" }, - { - "name": "lcobucci/jwt", - "version": "3.2.2", - "source": { - "type": "git", - "url": "https://github.com/lcobucci/jwt.git", - "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/0b5930be73582369e10c4d4bb7a12bac927a203c", - "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "php": ">=5.5" - }, - "require-dev": { - "mdanter/ecc": "~0.3.1", - "mikey179/vfsstream": "~1.5", - "phpmd/phpmd": "~2.2", - "phpunit/php-invoker": "~1.1", - "phpunit/phpunit": "~4.5", - "squizlabs/php_codesniffer": "~2.3" - }, - "suggest": { - "mdanter/ecc": "Required to use Elliptic Curves based algorithms." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Lcobucci\\JWT\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Luís Otávio Cobucci Oblonczyk", - "email": "lcobucci@gmail.com", - "role": "developer" - } - ], - "description": "A simple library to work with JSON Web Token and JSON Web Signature", - "keywords": [ - "JWS", - "jwt" - ], - "time": "2017-09-01T08:23:26+00:00" - }, { "name": "league/flysystem", "version": "1.0.45", diff --git a/config/jwt.php b/config/jwt.php deleted file mode 100644 index d51a7fae..00000000 --- a/config/jwt.php +++ /dev/null @@ -1,18 +0,0 @@ - env('APP_JWT_KEY'), - 'lifetime' => env('APP_JWT_LIFETIME', 1440), - - 'signer' => \Lcobucci\JWT\Signer\Hmac\Sha256::class, -]; diff --git a/package.json b/package.json index 0321cad9..0376d215 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "glob-all": "^3.1.0", "html-webpack-plugin": "^3.2.0", "jquery": "^3.3.1", - "jwt-decode": "^2.2.0", "lodash": "^4.17.5", "postcss": "^6.0.21", "postcss-import": "^11.1.0", diff --git a/yarn.lock b/yarn.lock index 36b084a6..e5536537 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3404,10 +3404,6 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" -jwt-decode@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79" - keygrip@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/keygrip/-/keygrip-1.0.2.tgz#ad3297c557069dea8bcfe7a4fa491b75c5ddeb91"