From 9f7053ae3d419466845b15011764a39459a0db0a Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 25 Jun 2024 18:04:16 +0200 Subject: [PATCH] feat: integrate Firebase PHP-JWT library Added composer configuration files to manage dependencies. Installed and configured the Firebase PHP-JWT library to handle JWT encoding and decoding. This enhancement aims to streamline JWT operations within the project. Also updated .gitignore to exclude Composer artifacts. --- .gitignore | 2 + classes/core_jwt_manager.php | 2 + composer.json | 5 +++ composer.lock | 82 ++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..957b255 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +composer.phar +vendor/ diff --git a/classes/core_jwt_manager.php b/classes/core_jwt_manager.php index 1736233..290d3aa 100644 --- a/classes/core_jwt_manager.php +++ b/classes/core_jwt_manager.php @@ -16,6 +16,8 @@ namespace auth_jwt; +require_once("../vendor/autoload.php"); + use \Firebase\JWT\JWT; /** diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..cace316 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "firebase/php-jwt": "^6.10" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..069604f --- /dev/null +++ b/composer.lock @@ -0,0 +1,82 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "dfe27548af6d83b7d428280eae1df087", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v6.10.1", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "500501c2ce893c824c801da135d02661199f60c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5", + "reference": "500501c2ce893c824c801da135d02661199f60c5", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^2.0||^3.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "ext-sodium": "Support EdDSA (Ed25519) signatures", + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.10.1" + }, + "time": "2024-05-18T18:05:11+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +}