From f0edd9cf52dc12fbdd9278650a70383b19968d98 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 16 May 2022 11:38:31 +0200 Subject: [PATCH] Require firebase JWT lib Signed-off-by: Joas Schilling --- Makefile | 18 +++++++--- composer.json | 3 ++ composer.lock | 67 +++++++++++++++++++++++++++++++++++-- lib/AppInfo/Application.php | 3 ++ 4 files changed, 84 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 72125499841..8bb4910bbb9 100644 --- a/Makefile +++ b/Makefile @@ -11,14 +11,22 @@ package_name=$(app_name) cert_dir=$(HOME)/.nextcloud/certificates version+=master -all: dev-setup build-js-production +all: dev-setup build-production -dev-setup: clean-dev npm-init - -dependabot: dev-setup npm-update build-js-production +dev-setup: clean-dev composer-install-dev npm-init release: appstore create-tag +build-dev: composer-install-dev build-js + +build-production: composer-install-production build-js-production + +composer-install-dev: + composer install + +composer-install-production: + composer install --no-dev + build-js: npm run dev @@ -49,6 +57,7 @@ clean: clean-dev: clean rm -rf node_modules + rm -rf vendor create-tag: git tag -a v$(version) -m "Tagging the $(version) release." @@ -89,7 +98,6 @@ appstore: --exclude=stylelint.config.js \ --exclude=.tx \ --exclude=tests \ - --exclude=vendor \ --exclude=webpack.js \ $(project_dir)/ $(sign_dir)/$(app_name) @if [ -f $(cert_dir)/$(app_name).key ]; then \ diff --git a/composer.json b/composer.json index 91f0b5dbae8..88cbe9e536a 100644 --- a/composer.json +++ b/composer.json @@ -26,5 +26,8 @@ "vimeo/psalm": "^4.22", "christophwurst/nextcloud": "dev-master", "phpunit/phpunit": "^9.5" + }, + "require": { + "firebase/php-jwt": "^6.2" } } diff --git a/composer.lock b/composer.lock index 4a409fdd77a..5e3979f788b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,71 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f1310c861606aff778b61ed4c3e7c757", - "packages": [], + "content-hash": "a2a77e84352e5a5444557e620927fbd0", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v6.2.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d28e6df83830252650da4623c78aaaf98fb385f3", + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3", + "shasum": "" + }, + "require": { + "php": "^7.1||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^1.1", + "phpunit/phpunit": "^7.5||^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "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.2.0" + }, + "time": "2022-05-13T20:54:50+00:00" + } + ], "packages-dev": [ { "name": "amphp/amp", diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 3d13c7c6641..fb14342081c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -110,6 +110,9 @@ public function __construct(array $urlParams = []) { } public function register(IRegistrationContext $context): void { + // Register the composer autoloader for packages shipped by this app + include_once __DIR__ . '/../../vendor/autoload.php'; + $context->registerMiddleWare(CanUseTalkMiddleware::class); $context->registerMiddleWare(InjectionMiddleware::class); $context->registerCapability(Capabilities::class);