From 2abb46e0a6554fea1fc4259f5b973ea05368b920 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 08:41:16 +0000 Subject: [PATCH 01/58] Bump phpunit/php-code-coverage from 9.2.3 to 9.2.4 Bumps [phpunit/php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage) from 9.2.3 to 9.2.4. - [Release notes](https://github.com/sebastianbergmann/php-code-coverage/releases) - [Changelog](https://github.com/sebastianbergmann/php-code-coverage/blob/master/ChangeLog.md) - [Commits](https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.3...9.2.4) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 346bfda7..689962af 100644 --- a/composer.lock +++ b/composer.lock @@ -2073,16 +2073,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.3", + "version": "9.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6b20e2055f7c29b56cb3870b3de7cc463d7add41" + "reference": "0a7f0acf9269c190fd982b5c04423feae986b6e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6b20e2055f7c29b56cb3870b3de7cc463d7add41", - "reference": "6b20e2055f7c29b56cb3870b3de7cc463d7add41", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0a7f0acf9269c190fd982b5c04423feae986b6e0", + "reference": "0a7f0acf9269c190fd982b5c04423feae986b6e0", "shasum": "" }, "require": { @@ -2142,7 +2142,7 @@ "type": "github" } ], - "time": "2020-10-30T10:46:41+00:00" + "time": "2020-11-27T06:15:15+00:00" }, { "name": "phpunit/php-file-iterator", From c566414488ac8313888a11e344ead572882bf1f7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2020 07:09:07 +0000 Subject: [PATCH 02/58] Bump sebastian/lines-of-code from 1.0.2 to 1.0.3 Bumps [sebastian/lines-of-code](https://github.com/sebastianbergmann/lines-of-code) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/sebastianbergmann/lines-of-code/releases) - [Changelog](https://github.com/sebastianbergmann/lines-of-code/blob/master/ChangeLog.md) - [Commits](https://github.com/sebastianbergmann/lines-of-code/compare/1.0.2...1.0.3) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 689962af..00773b78 100644 --- a/composer.lock +++ b/composer.lock @@ -3159,16 +3159,16 @@ }, { "name": "sebastian/lines-of-code", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "acf76492a65401babcf5283296fa510782783a7a" + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/acf76492a65401babcf5283296fa510782783a7a", - "reference": "acf76492a65401babcf5283296fa510782783a7a", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { @@ -3208,7 +3208,7 @@ "type": "github" } ], - "time": "2020-10-26T17:03:56+00:00" + "time": "2020-11-28T06:42:11+00:00" }, { "name": "sebastian/object-enumerator", From 8a1dc165ea163741c54dfb36f4d1d6126c8c80a4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2020 07:13:31 +0000 Subject: [PATCH 03/58] Bump phpunit/php-code-coverage from 9.2.4 to 9.2.5 Bumps [phpunit/php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage) from 9.2.4 to 9.2.5. - [Release notes](https://github.com/sebastianbergmann/php-code-coverage/releases) - [Changelog](https://github.com/sebastianbergmann/php-code-coverage/blob/master/ChangeLog.md) - [Commits](https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.4...9.2.5) Signed-off-by: dependabot-preview[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 00773b78..19a2e2b7 100644 --- a/composer.lock +++ b/composer.lock @@ -2073,16 +2073,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.4", + "version": "9.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0a7f0acf9269c190fd982b5c04423feae986b6e0" + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0a7f0acf9269c190fd982b5c04423feae986b6e0", - "reference": "0a7f0acf9269c190fd982b5c04423feae986b6e0", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", "shasum": "" }, "require": { @@ -2096,7 +2096,7 @@ "sebastian/code-unit-reverse-lookup": "^2.0.2", "sebastian/complexity": "^2.0", "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0", + "sebastian/lines-of-code": "^1.0.3", "sebastian/version": "^3.0.1", "theseer/tokenizer": "^1.2.0" }, @@ -2142,7 +2142,7 @@ "type": "github" } ], - "time": "2020-11-27T06:15:15+00:00" + "time": "2020-11-28T06:44:49+00:00" }, { "name": "phpunit/php-file-iterator", From f46452e7ce4d4e02925e4b57534b3d8062bc90ba Mon Sep 17 00:00:00 2001 From: Hossein Hashemi Date: Sat, 28 Nov 2020 20:31:28 +0330 Subject: [PATCH 04/58] Update validating-tokens.md --- docs/validating-tokens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index 69c5b86b..cf125168 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -18,7 +18,7 @@ use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Token\Plain; use Lcobucci\JWT\Validation\RequiredConstraintsViolated; -$token = $container->get(Configuration::class); +$config = $container->get(Configuration::class); assert($config instanceof Configuration); $token = $config->parser()->parse('...'); From 56fd6f74556b780d7dcd87526809dc383e4a6999 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2020 13:49:25 +0000 Subject: [PATCH 05/58] Bump phpstan/phpstan from 0.12.57 to 0.12.58 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.57 to 0.12.58. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Commits](https://github.com/phpstan/phpstan/compare/0.12.57...0.12.58) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 19a2e2b7..a7b87e73 100644 --- a/composer.lock +++ b/composer.lock @@ -1859,16 +1859,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.57", + "version": "0.12.58", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f9909d1d0c44b4cbaf72babcf80e8f14d6fdd55b" + "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f9909d1d0c44b4cbaf72babcf80e8f14d6fdd55b", - "reference": "f9909d1d0c44b4cbaf72babcf80e8f14d6fdd55b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a4847df6047b30af28854ed9dc95304cdb56ae5", + "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5", "shasum": "" }, "require": { @@ -1911,7 +1911,7 @@ "type": "tidelift" } ], - "time": "2020-11-21T12:53:28+00:00" + "time": "2020-11-29T13:32:03+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From 1c7f58dbde01f171efd352cfef291884984b7821 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:36:36 +0000 Subject: [PATCH 06/58] Bump symfony/options-resolver from 5.1.8 to 5.1.9 Bumps [symfony/options-resolver](https://github.com/symfony/options-resolver) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/options-resolver/releases) - [Changelog](https://github.com/symfony/options-resolver/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/options-resolver/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index a7b87e73..dcf71ffe 100644 --- a/composer.lock +++ b/composer.lock @@ -4029,7 +4029,7 @@ }, { "name": "symfony/options-resolver", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", From e729781ba83afd684a3329dd32dbacd72f24ed7a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:39:22 +0000 Subject: [PATCH 07/58] Bump symfony/string from 5.1.8 to 5.1.9 Bumps [symfony/string](https://github.com/symfony/string) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/string/releases) - [Changelog](https://github.com/symfony/string/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/string/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index dcf71ffe..881bffb6 100644 --- a/composer.lock +++ b/composer.lock @@ -4697,7 +4697,7 @@ }, { "name": "symfony/string", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", From fc05cba9933021267c2297e768d7bbfca0af1503 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:42:55 +0000 Subject: [PATCH 08/58] Bump symfony/console from 5.1.8 to 5.1.9 Bumps [symfony/console](https://github.com/symfony/console) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/console/releases) - [Changelog](https://github.com/symfony/console/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/console/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 881bffb6..1e925e03 100644 --- a/composer.lock +++ b/composer.lock @@ -3694,16 +3694,16 @@ }, { "name": "symfony/console", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e" + "reference": "037b57ac42cafb64b7b55273fe1786f35d623077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", - "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", + "url": "https://api.github.com/repos/symfony/console/zipball/037b57ac42cafb64b7b55273fe1786f35d623077", + "reference": "037b57ac42cafb64b7b55273fe1786f35d623077", "shasum": "" }, "require": { @@ -3778,7 +3778,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-28T10:57:20+00:00" }, { "name": "symfony/debug", From c29ae1d78d54fb173390eb096c197c0e86ccff40 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:52:06 +0000 Subject: [PATCH 09/58] Bump symfony/finder from 5.1.8 to 5.1.9 Bumps [symfony/finder](https://github.com/symfony/finder) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/finder/releases) - [Changelog](https://github.com/symfony/finder/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/finder/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1e925e03..57956707 100644 --- a/composer.lock +++ b/composer.lock @@ -3971,16 +3971,16 @@ }, { "name": "symfony/finder", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "e70eb5a69c2ff61ea135a13d2266e8914a67b3a0" + "reference": "fd8305521692f27eae3263895d1ef1571c71a78d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e70eb5a69c2ff61ea135a13d2266e8914a67b3a0", - "reference": "e70eb5a69c2ff61ea135a13d2266e8914a67b3a0", + "url": "https://api.github.com/repos/symfony/finder/zipball/fd8305521692f27eae3263895d1ef1571c71a78d", + "reference": "fd8305521692f27eae3263895d1ef1571c71a78d", "shasum": "" }, "require": { @@ -4025,7 +4025,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-18T09:42:36+00:00" }, { "name": "symfony/options-resolver", From 3e0e1794a86afcdd42a8c015d913ff770977b828 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 05:08:52 +0000 Subject: [PATCH 10/58] Bump symfony/filesystem from 5.1.8 to 5.1.9 Bumps [symfony/filesystem](https://github.com/symfony/filesystem) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/filesystem/releases) - [Changelog](https://github.com/symfony/filesystem/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/filesystem/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 57956707..e505b57b 100644 --- a/composer.lock +++ b/composer.lock @@ -3912,16 +3912,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "df08650ea7aee2d925380069c131a66124d79177" + "reference": "bb92ba7f38b037e531908590a858a04d85c0e238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/df08650ea7aee2d925380069c131a66124d79177", - "reference": "df08650ea7aee2d925380069c131a66124d79177", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb92ba7f38b037e531908590a858a04d85c0e238", + "reference": "bb92ba7f38b037e531908590a858a04d85c0e238", "shasum": "" }, "require": { @@ -3967,7 +3967,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-12T09:58:18+00:00" }, { "name": "symfony/finder", From cad8cf3feba5205e16e7076a08ebbf355a421090 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 05:13:51 +0000 Subject: [PATCH 11/58] Bump symfony/process from 5.1.8 to 5.1.9 Bumps [symfony/process](https://github.com/symfony/process) from 5.1.8 to 5.1.9. - [Release notes](https://github.com/symfony/process/releases) - [Changelog](https://github.com/symfony/process/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/process/compare/v5.1.8...v5.1.9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e505b57b..dd21b326 100644 --- a/composer.lock +++ b/composer.lock @@ -4562,16 +4562,16 @@ }, { "name": "symfony/process", - "version": "v5.1.8", + "version": "v5.1.9", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f00872c3f6804150d6a0f73b4151daab96248101" + "reference": "b25b468538c82f6594058aabaa9bac48d7ef2170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f00872c3f6804150d6a0f73b4151daab96248101", - "reference": "f00872c3f6804150d6a0f73b4151daab96248101", + "url": "https://api.github.com/repos/symfony/process/zipball/b25b468538c82f6594058aabaa9bac48d7ef2170", + "reference": "b25b468538c82f6594058aabaa9bac48d7ef2170", "shasum": "" }, "require": { @@ -4617,7 +4617,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-02T15:45:32+00:00" }, { "name": "symfony/service-contracts", From b883e3f5a63abde76e81f796fb28e2172c204068 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 05:18:55 +0000 Subject: [PATCH 12/58] Bump symfony/debug from 4.4.16 to 4.4.17 Bumps [symfony/debug](https://github.com/symfony/debug) from 4.4.16 to 4.4.17. - [Release notes](https://github.com/symfony/debug/releases) - [Changelog](https://github.com/symfony/debug/blob/4.4/CHANGELOG.md) - [Commits](https://github.com/symfony/debug/compare/v4.4.16...v4.4.17) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index dd21b326..c35095fa 100644 --- a/composer.lock +++ b/composer.lock @@ -3782,16 +3782,16 @@ }, { "name": "symfony/debug", - "version": "v4.4.16", + "version": "v4.4.17", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "c87adf3fc1cd0bf4758316a3a150d50a8f957ef4" + "reference": "65fe7b49868378319b82da3035fb30801b931c47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/c87adf3fc1cd0bf4758316a3a150d50a8f957ef4", - "reference": "c87adf3fc1cd0bf4758316a3a150d50a8f957ef4", + "url": "https://api.github.com/repos/symfony/debug/zipball/65fe7b49868378319b82da3035fb30801b931c47", + "reference": "65fe7b49868378319b82da3035fb30801b931c47", "shasum": "" }, "require": { @@ -3844,7 +3844,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T11:50:19+00:00" + "time": "2020-10-28T20:42:29+00:00" }, { "name": "symfony/deprecation-contracts", From 35e4ec1aed60a3f77ca3c6b536a0a639f4d4face Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 10:50:57 +0000 Subject: [PATCH 13/58] Bump phar-io/version from 3.0.2 to 3.0.3 Bumps [phar-io/version](https://github.com/phar-io/version) from 3.0.2 to 3.0.3. - [Release notes](https://github.com/phar-io/version/releases) - [Changelog](https://github.com/phar-io/version/blob/master/CHANGELOG.md) - [Commits](https://github.com/phar-io/version/compare/3.0.2...3.0.3) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index c35095fa..28bd9453 100644 --- a/composer.lock +++ b/composer.lock @@ -1343,16 +1343,16 @@ }, { "name": "phar-io/version", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0" + "reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/c6bb6825def89e0a32220f88337f8ceaf1975fa0", - "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0", + "url": "https://api.github.com/repos/phar-io/version/zipball/726c026815142e4f8677b7cb7f2249c9ffb7ecae", + "reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae", "shasum": "" }, "require": { @@ -1386,7 +1386,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2020-06-27T14:39:04+00:00" + "time": "2020-11-30T09:21:21+00:00" }, { "name": "phpbench/container", From 238f090806286bd9a9368a88391e8bed7d36fb90 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 04:33:17 +0000 Subject: [PATCH 14/58] Bump symfony/filesystem from 5.1.9 to 5.2.0 Bumps [symfony/filesystem](https://github.com/symfony/filesystem) from 5.1.9 to 5.2.0. - [Release notes](https://github.com/symfony/filesystem/releases) - [Changelog](https://github.com/symfony/filesystem/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/filesystem/compare/v5.1.9...v5.2.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 28bd9453..d02d1c1a 100644 --- a/composer.lock +++ b/composer.lock @@ -3912,7 +3912,7 @@ }, { "name": "symfony/filesystem", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", From 111da9518da4b5c81fee0933916af3b461d6d416 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 04:35:59 +0000 Subject: [PATCH 15/58] Bump symfony/console from 5.1.9 to 5.2.0 Bumps [symfony/console](https://github.com/symfony/console) from 5.1.9 to 5.2.0. - [Release notes](https://github.com/symfony/console/releases) - [Changelog](https://github.com/symfony/console/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/console/compare/v5.1.9...v5.2.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index d02d1c1a..4aa67c59 100644 --- a/composer.lock +++ b/composer.lock @@ -3694,16 +3694,16 @@ }, { "name": "symfony/console", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "037b57ac42cafb64b7b55273fe1786f35d623077" + "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/037b57ac42cafb64b7b55273fe1786f35d623077", - "reference": "037b57ac42cafb64b7b55273fe1786f35d623077", + "url": "https://api.github.com/repos/symfony/console/zipball/3e0564fb08d44a98bd5f1960204c958e57bd586b", + "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b", "shasum": "" }, "require": { @@ -3764,6 +3764,12 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "funding": [ { "url": "https://symfony.com/sponsor", @@ -3778,7 +3784,7 @@ "type": "tidelift" } ], - "time": "2020-11-28T10:57:20+00:00" + "time": "2020-11-28T11:24:18+00:00" }, { "name": "symfony/debug", @@ -4697,16 +4703,16 @@ }, { "name": "symfony/string", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea" + "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/a97573e960303db71be0dd8fda9be3bca5e0feea", - "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea", + "url": "https://api.github.com/repos/symfony/string/zipball/40e975edadd4e32cd16f3753b3bad65d9ac48242", + "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242", "shasum": "" }, "require": { @@ -4773,7 +4779,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-10-24T12:08:07+00:00" }, { "name": "thecodingmachine/safe", From 8a70477430de93c4682c98c264cf81ae644e18d6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 04:50:02 +0000 Subject: [PATCH 16/58] Bump symfony/options-resolver from 5.1.9 to 5.2.0 Bumps [symfony/options-resolver](https://github.com/symfony/options-resolver) from 5.1.9 to 5.2.0. - [Release notes](https://github.com/symfony/options-resolver/releases) - [Changelog](https://github.com/symfony/options-resolver/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/options-resolver/compare/v5.1.9...v5.2.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 4aa67c59..6bf13893 100644 --- a/composer.lock +++ b/composer.lock @@ -4035,21 +4035,22 @@ }, { "name": "symfony/options-resolver", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "c6a02905e4ffc7a1498e8ee019db2b477cd1cc02" + "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/c6a02905e4ffc7a1498e8ee019db2b477cd1cc02", - "reference": "c6a02905e4ffc7a1498e8ee019db2b477cd1cc02", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/87a2a4a766244e796dd9cb9d6f58c123358cd986", + "reference": "87a2a4a766244e796dd9cb9d6f58c123358cd986", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php73": "~1.0", "symfony/polyfill-php80": "^1.15" }, "type": "library", @@ -4096,7 +4097,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-10-24T12:08:07+00:00" }, { "name": "symfony/polyfill-ctype", From ca0dfa62de12aeab93a3adfba04430db1b753309 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 04:59:33 +0000 Subject: [PATCH 17/58] Bump symfony/finder from 5.1.9 to 5.2.0 Bumps [symfony/finder](https://github.com/symfony/finder) from 5.1.9 to 5.2.0. - [Release notes](https://github.com/symfony/finder/releases) - [Changelog](https://github.com/symfony/finder/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/finder/compare/v5.1.9...v5.2.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 6bf13893..598afeb4 100644 --- a/composer.lock +++ b/composer.lock @@ -3977,7 +3977,7 @@ }, { "name": "symfony/finder", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", From 4458d87e4fbf53eca4d51a63be04d8dbc115d9ac Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 05:05:15 +0000 Subject: [PATCH 18/58] Bump symfony/process from 5.1.9 to 5.2.0 Bumps [symfony/process](https://github.com/symfony/process) from 5.1.9 to 5.2.0. - [Release notes](https://github.com/symfony/process/releases) - [Changelog](https://github.com/symfony/process/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/symfony/process/compare/v5.1.9...v5.2.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 598afeb4..b7940dc1 100644 --- a/composer.lock +++ b/composer.lock @@ -4569,16 +4569,16 @@ }, { "name": "symfony/process", - "version": "v5.1.9", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b25b468538c82f6594058aabaa9bac48d7ef2170" + "reference": "240e74140d4d956265048f3025c0aecbbc302d54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b25b468538c82f6594058aabaa9bac48d7ef2170", - "reference": "b25b468538c82f6594058aabaa9bac48d7ef2170", + "url": "https://api.github.com/repos/symfony/process/zipball/240e74140d4d956265048f3025c0aecbbc302d54", + "reference": "240e74140d4d956265048f3025c0aecbbc302d54", "shasum": "" }, "require": { @@ -4624,7 +4624,7 @@ "type": "tidelift" } ], - "time": "2020-11-02T15:45:32+00:00" + "time": "2020-11-02T15:47:15+00:00" }, { "name": "symfony/service-contracts", From a7e967f1e1a03cfb83db6022129889b7a0841ace Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 05:33:24 +0000 Subject: [PATCH 19/58] Bump phpunit/phpunit from 9.4.3 to 9.4.4 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.4.3 to 9.4.4. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.4.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.4.3...9.4.4) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b7940dc1..c09ec721 100644 --- a/composer.lock +++ b/composer.lock @@ -2371,16 +2371,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.4.3", + "version": "9.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab" + "reference": "6535e637961f0829832621dc1b7308c2d24a799e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab", - "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6535e637961f0829832621dc1b7308c2d24a799e", + "reference": "6535e637961f0829832621dc1b7308c2d24a799e", "shasum": "" }, "require": { @@ -2466,7 +2466,7 @@ "type": "github" } ], - "time": "2020-11-10T12:53:30+00:00" + "time": "2020-12-01T04:58:47+00:00" }, { "name": "psr/container", From 31d4fb236aaac15abb95f490fc4690d2ac21c76b Mon Sep 17 00:00:00 2001 From: Volodymyr Mikhav Date: Tue, 1 Dec 2020 14:57:27 +0200 Subject: [PATCH 20/58] Fix validation doc --- docs/validating-tokens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index cf125168..6e8aac25 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -45,7 +45,7 @@ The difference here is that we'll always a get a `boolean` result and stop in th use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Token\Plain; -$token = $container->get(Configuration::class); +$config = $container->get(Configuration::class); assert($config instanceof Configuration); $token = $config->parser()->parse('...'); From 828c17ca8cbdf5e3ee0cebdd5969bc11fc26c17d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:50:19 +0000 Subject: [PATCH 21/58] Bump nikic/php-parser from 4.10.2 to 4.10.3 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.10.2 to 4.10.3. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.10.2...v4.10.3) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index c09ec721..6e9e9f13 100644 --- a/composer.lock +++ b/composer.lock @@ -1106,16 +1106,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.2", + "version": "v4.10.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de" + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", "shasum": "" }, "require": { @@ -1154,7 +1154,7 @@ "parser", "php" ], - "time": "2020-09-26T10:30:38+00:00" + "time": "2020-12-03T17:45:45+00:00" }, { "name": "ocramius/package-versions", From 4aa223301a464293ead3cb42a94dea764e955cd6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2020 06:14:09 +0000 Subject: [PATCH 22/58] Bump phpunit/phpunit from 9.4.4 to 9.5.0 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.4.4 to 9.5.0. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.4.4...9.5.0) Signed-off-by: dependabot-preview[bot] --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index b6788da6..ff4c2271 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "phpstan/phpstan-phpunit": "^0.12", "phpstan/phpstan-strict-rules": "^0.12", "phpunit/php-invoker": "^3.1", - "phpunit/phpunit": "^9.4" + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 6e9e9f13..fc746a70 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "36f5b286daebc58d9834b6e695dba174", + "content-hash": "23679d7517bff66a508e93c193db939d", "packages": [ { "name": "lcobucci/clock", @@ -2371,16 +2371,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.4.4", + "version": "9.5.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6535e637961f0829832621dc1b7308c2d24a799e" + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6535e637961f0829832621dc1b7308c2d24a799e", - "reference": "6535e637961f0829832621dc1b7308c2d24a799e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", "shasum": "" }, "require": { @@ -2396,7 +2396,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2", + "phpunit/php-code-coverage": "^9.2.3", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2427,7 +2427,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.4-dev" + "dev-master": "9.5-dev" } }, "autoload": { @@ -2466,7 +2466,7 @@ "type": "github" } ], - "time": "2020-12-01T04:58:47+00:00" + "time": "2020-12-04T05:05:53+00:00" }, { "name": "psr/container", From 3025aad660e9bbcbeadc437602b11dbe097f0a02 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Dec 2020 15:05:39 +0000 Subject: [PATCH 23/58] Bump phpstan/phpstan from 0.12.58 to 0.12.59 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.58 to 0.12.59. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Commits](https://github.com/phpstan/phpstan/compare/0.12.58...0.12.59) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index fc746a70..5612b246 100644 --- a/composer.lock +++ b/composer.lock @@ -1859,16 +1859,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.58", + "version": "0.12.59", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5" + "reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a4847df6047b30af28854ed9dc95304cdb56ae5", - "reference": "2a4847df6047b30af28854ed9dc95304cdb56ae5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cf4107257c8ca2ad967efdd6a00f12b21acbb779", + "reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779", "shasum": "" }, "require": { @@ -1911,7 +1911,7 @@ "type": "tidelift" } ], - "time": "2020-11-29T13:32:03+00:00" + "time": "2020-12-07T14:46:03+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From 4980e96ea279c28ae64f20820532bb829605c662 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 8 Dec 2020 04:33:55 +0000 Subject: [PATCH 24/58] Bump dealerdirect/phpcodesniffer-composer-installer from 0.7.0 to 0.7.1 Bumps dealerdirect/phpcodesniffer-composer-installer from 0.7.0 to 0.7.1. Signed-off-by: dependabot-preview[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5612b246..0709ddf9 100644 --- a/composer.lock +++ b/composer.lock @@ -186,22 +186,22 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.0", + "version": "v0.7.1", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7" + "reference": "fe390591e0241955f22eb9ba327d137e501c771c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" + "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" }, "require-dev": { "composer/composer": "*", @@ -248,7 +248,7 @@ "stylecheck", "tests" ], - "time": "2020-06-25T14:57:39+00:00" + "time": "2020-12-07T18:04:37+00:00" }, { "name": "doctrine/annotations", From 46f8d74137a4821dbd3b3ce7a706f826a3b71f92 Mon Sep 17 00:00:00 2001 From: baijunyao Date: Tue, 8 Dec 2020 14:31:13 +0800 Subject: [PATCH 25/58] Fix autoload.php path error --- docs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index c756b000..012eb6c3 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -16,7 +16,7 @@ composer require lcobucci/jwt In order to be able to use the classes provided by this library you're also required to include [Composer]'s autoloader in your application: ```php -require 'vendor/bin/autoload.php'; +require 'vendor/autoload.php'; ``` !!! Tip From 4bad2608a24a45c77d1e88b8442aee24d31d122b Mon Sep 17 00:00:00 2001 From: baijunyao Date: Tue, 8 Dec 2020 16:05:32 +0800 Subject: [PATCH 26/58] Fix letter case error --- docs/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 3fde6911..428acd82 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -83,7 +83,7 @@ use Lcobucci\JWT\Signer\Key\InMemory; $configuration = Configuration::forAsymmetricSigner( // You may use RSA or ECDSA and all their variations (256, 384, and 512) - new Signer\RSA\Sha256(), + new Signer\Rsa\Sha256(), LocalFileReference::file(__DIR__ . '/my-private-key.pem'), InMemory::base64Encoded('mBC5v1sOKVvbdEitdSBenu59nfNfhwkedkJVNabosTw=') // You may also override the JOSE encoder/decoder if needed by providing extra arguments here From 7dad9759ae85cd5bdd424066f8975cd56d7d0d95 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 25 Nov 2020 14:32:22 +0100 Subject: [PATCH 27/58] Rename ValidAt to LooseValidAt --- docs/validating-tokens.md | 2 +- .../{ValidAt.php => LooseValidAt.php} | 2 +- test/functional/UnsignedTokenTest.php | 6 +++--- .../{ValidAtTest.php => LooseValidAtTest.php} | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) rename src/Validation/Constraint/{ValidAt.php => LooseValidAt.php} (97%) rename test/unit/Validation/Constraint/{ValidAtTest.php => LooseValidAtTest.php} (92%) diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index 6e8aac25..3f5ca1b6 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -67,6 +67,6 @@ This library provides the following constraints: * `Lcobucci\JWT\Validation\Constraint\PermittedFor`: verifies if the claim `aud` contains the expected value * `Lcobucci\JWT\Validation\Constraint\RelatedTo`: verifies if the claim `sub` matches the expected value * `Lcobucci\JWT\Validation\Constraint\SignedWith`: verifies if the token was signed with the expected signer and key -* `Lcobucci\JWT\Validation\Constraint\ValidAt`: verifies the claims `iat`, `nbf`, and `exp` (supports leeway configuration) +* `Lcobucci\JWT\Validation\Constraint\LooseValidAt`: verifies the claims `iat`, `nbf`, and `exp` (supports leeway configuration) You may also create your [own validation constraints](extending-the-library.md#validation-constraints). diff --git a/src/Validation/Constraint/ValidAt.php b/src/Validation/Constraint/LooseValidAt.php similarity index 97% rename from src/Validation/Constraint/ValidAt.php rename to src/Validation/Constraint/LooseValidAt.php index 61866864..5b1b7ae6 100644 --- a/src/Validation/Constraint/ValidAt.php +++ b/src/Validation/Constraint/LooseValidAt.php @@ -10,7 +10,7 @@ use Lcobucci\JWT\Validation\Constraint; use Lcobucci\JWT\Validation\ConstraintViolation; -final class ValidAt implements Constraint +final class LooseValidAt implements Constraint { private Clock $clock; private DateInterval $leeway; diff --git a/test/functional/UnsignedTokenTest.php b/test/functional/UnsignedTokenTest.php index f661bfd1..44a5fb78 100644 --- a/test/functional/UnsignedTokenTest.php +++ b/test/functional/UnsignedTokenTest.php @@ -10,8 +10,8 @@ use Lcobucci\JWT\Validation\Constraint; use Lcobucci\JWT\Validation\Constraint\IdentifiedBy; use Lcobucci\JWT\Validation\Constraint\IssuedBy; +use Lcobucci\JWT\Validation\Constraint\LooseValidAt; use Lcobucci\JWT\Validation\Constraint\PermittedFor; -use Lcobucci\JWT\Validation\Constraint\ValidAt; use Lcobucci\JWT\Validation\ConstraintViolation; use Lcobucci\JWT\Validation\RequiredConstraintsViolated; use PHPUnit\Framework\TestCase; @@ -36,7 +36,7 @@ * @covers \Lcobucci\JWT\Validation\Constraint\IssuedBy * @covers \Lcobucci\JWT\Validation\Constraint\PermittedFor * @covers \Lcobucci\JWT\Validation\Constraint\IdentifiedBy - * @covers \Lcobucci\JWT\Validation\Constraint\ValidAt + * @covers \Lcobucci\JWT\Validation\Constraint\LooseValidAt */ class UnsignedTokenTest extends TestCase { @@ -99,7 +99,7 @@ public function tokenValidationShouldPassWhenEverythingIsFine(Token $generated): new IdentifiedBy('1'), new PermittedFor('http://client.abc.com'), new IssuedBy('http://issuer.abc.com', 'http://api.abc.com'), - new ValidAt($clock), + new LooseValidAt($clock), ]; self::assertTrue($this->config->validator()->validate($generated, ...$constraints)); diff --git a/test/unit/Validation/Constraint/ValidAtTest.php b/test/unit/Validation/Constraint/LooseValidAtTest.php similarity index 92% rename from test/unit/Validation/Constraint/ValidAtTest.php rename to test/unit/Validation/Constraint/LooseValidAtTest.php index 4234c4d7..b8b6d17e 100644 --- a/test/unit/Validation/Constraint/ValidAtTest.php +++ b/test/unit/Validation/Constraint/LooseValidAtTest.php @@ -10,8 +10,8 @@ use Lcobucci\JWT\Token\RegisteredClaims; use Lcobucci\JWT\Validation\ConstraintViolation; -/** @coversDefaultClass \Lcobucci\JWT\Validation\Constraint\ValidAt */ -final class ValidAtTest extends ConstraintTestCase +/** @coversDefaultClass \Lcobucci\JWT\Validation\Constraint\LooseValidAt */ +final class LooseValidAtTest extends ConstraintTestCase { private Clock $clock; @@ -36,7 +36,7 @@ public function constructShouldRaiseExceptionOnNegativeLeeway(): void $this->expectException(LeewayCannotBeNegative::class); $this->expectExceptionMessage('Leeway cannot be negative'); - new ValidAt($this->clock, $leeway); + new LooseValidAt($this->clock, $leeway); } /** @@ -66,7 +66,7 @@ public function assertShouldRaiseExceptionWhenTokenIsExpired(): void $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token is expired'); - $constraint = new ValidAt($this->clock); + $constraint = new LooseValidAt($this->clock); $constraint->assert($this->buildToken($claims)); } @@ -96,7 +96,7 @@ public function assertShouldRaiseExceptionWhenMinimumTimeIsNotMet(): void $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token cannot be used yet'); - $constraint = new ValidAt($this->clock); + $constraint = new LooseValidAt($this->clock); $constraint->assert($this->buildToken($claims)); } @@ -125,7 +125,7 @@ public function assertShouldRaiseExceptionWhenTokenWasIssuedInTheFuture(): void $this->expectException(ConstraintViolation::class); $this->expectExceptionMessage('The token was issued in the future'); - $constraint = new ValidAt($this->clock); + $constraint = new LooseValidAt($this->clock); $constraint->assert($this->buildToken($claims)); } @@ -153,7 +153,7 @@ public function assertShouldNotRaiseExceptionWhenLeewayIsUsed(): void RegisteredClaims::EXPIRATION_TIME => $now->modify('-5 seconds'), ]; - $constraint = new ValidAt($this->clock, new DateInterval('PT5S')); + $constraint = new LooseValidAt($this->clock, new DateInterval('PT5S')); $constraint->assert($this->buildToken($claims)); $this->addToAssertionCount(1); @@ -175,7 +175,7 @@ public function assertShouldNotRaiseExceptionWhenLeewayIsUsed(): void */ public function assertShouldNotRaiseExceptionWhenTokenIsUsedInTheRightMoment(): void { - $constraint = new ValidAt($this->clock); + $constraint = new LooseValidAt($this->clock); $now = $this->clock->now(); $token = $this->buildToken( @@ -218,7 +218,7 @@ public function assertShouldNotRaiseExceptionWhenTokenIsUsedInTheRightMoment(): public function assertShouldNotRaiseExceptionWhenTokenDoesNotHaveTimeClaims(): void { $token = $this->buildToken(); - $constraint = new ValidAt($this->clock); + $constraint = new LooseValidAt($this->clock); $constraint->assert($token); $this->addToAssertionCount(1); From 9b37d9871f1eae67268378521891ef3284310f59 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 25 Nov 2020 15:01:06 +0100 Subject: [PATCH 28/58] Create ValidAt proxy to LooseValidAt, and deprecate it --- src/Validation/Constraint/ValidAt.php | 25 +++++++++++ .../Validation/Constraint/ValidAtTest.php | 43 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 src/Validation/Constraint/ValidAt.php create mode 100644 test/unit/Validation/Constraint/ValidAtTest.php diff --git a/src/Validation/Constraint/ValidAt.php b/src/Validation/Constraint/ValidAt.php new file mode 100644 index 00000000..db7f6baf --- /dev/null +++ b/src/Validation/Constraint/ValidAt.php @@ -0,0 +1,25 @@ +constraint = new LooseValidAt($clock, $leeway); + } + + public function assert(Token $token): void + { + $this->constraint->assert($token); + } +} diff --git a/test/unit/Validation/Constraint/ValidAtTest.php b/test/unit/Validation/Constraint/ValidAtTest.php new file mode 100644 index 00000000..5ed3346d --- /dev/null +++ b/test/unit/Validation/Constraint/ValidAtTest.php @@ -0,0 +1,43 @@ + $clock->now(), + RegisteredClaims::NOT_BEFORE => $clock->now()->modify('+5 seconds'), + RegisteredClaims::EXPIRATION_TIME => $clock->now()->modify('15 seconds'), + ]; + + // @phpstan-ignore-next-line + $constraint = new ValidAt($clock, new DateInterval('PT1S')); + + $clock->setTo($clock->now()->modify('+4 seconds')); + $constraint->assert($this->buildToken($claims)); + $this->addToAssertionCount(1); + + $this->expectException(ConstraintViolation::class); + + $clock->setTo($clock->now()->modify('+20 seconds')); + $constraint->assert($this->buildToken($claims)); + } +} From 4e4682751b74be2ff1e1587cba146de170c053fe Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 1 Dec 2020 13:21:16 +0100 Subject: [PATCH 29/58] Add StrictValidAt constraint --- src/Validation/Constraint/StrictValidAt.php | 85 ++++++++ .../Constraint/LooseValidAtTest.php | 196 +---------------- .../Constraint/StrictValidAtTest.php | 117 ++++++++++ .../Validation/Constraint/ValidAtTest.php | 5 + .../Validation/Constraint/ValidAtTestCase.php | 205 ++++++++++++++++++ 5 files changed, 417 insertions(+), 191 deletions(-) create mode 100644 src/Validation/Constraint/StrictValidAt.php create mode 100644 test/unit/Validation/Constraint/StrictValidAtTest.php create mode 100644 test/unit/Validation/Constraint/ValidAtTestCase.php diff --git a/src/Validation/Constraint/StrictValidAt.php b/src/Validation/Constraint/StrictValidAt.php new file mode 100644 index 00000000..26cbd167 --- /dev/null +++ b/src/Validation/Constraint/StrictValidAt.php @@ -0,0 +1,85 @@ +clock = $clock; + $this->leeway = $this->guardLeeway($leeway); + } + + private function guardLeeway(?DateInterval $leeway): DateInterval + { + if ($leeway === null) { + return new DateInterval('PT0S'); + } + + if ($leeway->invert === 1) { + throw LeewayCannotBeNegative::create(); + } + + return $leeway; + } + + public function assert(Token $token): void + { + if (! $token instanceof Token\Plain) { + throw new ConstraintViolation('You should pass a plain token'); + } + + $now = $this->clock->now(); + + $this->assertIssueTime($token, $now->add($this->leeway)); + $this->assertMinimumTime($token, $now->add($this->leeway)); + $this->assertExpiration($token, $now->sub($this->leeway)); + } + + /** @throws ConstraintViolation */ + private function assertExpiration(Token\Plain $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::EXPIRATION_TIME)) { + throw new ConstraintViolation('"Expiration Time" claim missing'); + } + + if ($token->isExpired($now)) { + throw new ConstraintViolation('The token is expired'); + } + } + + /** @throws ConstraintViolation */ + private function assertMinimumTime(Token\Plain $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::NOT_BEFORE)) { + throw new ConstraintViolation('"Not Before" claim missing'); + } + + if (! $token->isMinimumTimeBefore($now)) { + throw new ConstraintViolation('The token cannot be used yet'); + } + } + + /** @throws ConstraintViolation */ + private function assertIssueTime(Token\Plain $token, DateTimeInterface $now): void + { + if (! $token->claims()->has(Token\RegisteredClaims::ISSUED_AT)) { + throw new ConstraintViolation('"Issued At" claim missing'); + } + + if (! $token->hasBeenIssuedBefore($now)) { + throw new ConstraintViolation('The token was issued in the future'); + } + } +} diff --git a/test/unit/Validation/Constraint/LooseValidAtTest.php b/test/unit/Validation/Constraint/LooseValidAtTest.php index b8b6d17e..b741a69b 100644 --- a/test/unit/Validation/Constraint/LooseValidAtTest.php +++ b/test/unit/Validation/Constraint/LooseValidAtTest.php @@ -4,201 +4,15 @@ namespace Lcobucci\JWT\Validation\Constraint; use DateInterval; -use DateTimeImmutable; use Lcobucci\Clock\Clock; -use Lcobucci\Clock\FrozenClock; -use Lcobucci\JWT\Token\RegisteredClaims; -use Lcobucci\JWT\Validation\ConstraintViolation; +use Lcobucci\JWT\Validation\Constraint; /** @coversDefaultClass \Lcobucci\JWT\Validation\Constraint\LooseValidAt */ -final class LooseValidAtTest extends ConstraintTestCase +final class LooseValidAtTest extends ValidAtTestCase { - private Clock $clock; - - /** @before */ - public function createDependencies(): void - { - $this->clock = new FrozenClock(new DateTimeImmutable()); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers \Lcobucci\JWT\Validation\Constraint\LeewayCannotBeNegative - */ - public function constructShouldRaiseExceptionOnNegativeLeeway(): void - { - $leeway = new DateInterval('PT30S'); - $leeway->invert = 1; - - $this->expectException(LeewayCannotBeNegative::class); - $this->expectExceptionMessage('Leeway cannot be negative'); - - new LooseValidAt($this->clock, $leeway); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers ::assert - * @covers ::assertExpiration - * @covers ::assertIssueTime - * @covers ::assertMinimumTime - * - * @uses \Lcobucci\JWT\Token\DataSet - * @uses \Lcobucci\JWT\Token\Plain - * @uses \Lcobucci\JWT\Token\Signature - */ - public function assertShouldRaiseExceptionWhenTokenIsExpired(): void + protected function buildValidAtConstraint(Clock $clock, ?DateInterval $leeway = null): Constraint { - $now = $this->clock->now(); - - $claims = [ - RegisteredClaims::ISSUED_AT => $now->modify('-20 seconds'), - RegisteredClaims::NOT_BEFORE => $now->modify('-10 seconds'), - RegisteredClaims::EXPIRATION_TIME => $now->modify('-10 seconds'), - ]; - - $this->expectException(ConstraintViolation::class); - $this->expectExceptionMessage('The token is expired'); - - $constraint = new LooseValidAt($this->clock); - $constraint->assert($this->buildToken($claims)); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers ::assert - * @covers ::assertIssueTime - * @covers ::assertMinimumTime - * - * @uses \Lcobucci\JWT\Token\DataSet - * @uses \Lcobucci\JWT\Token\Plain - * @uses \Lcobucci\JWT\Token\Signature - */ - public function assertShouldRaiseExceptionWhenMinimumTimeIsNotMet(): void - { - $now = $this->clock->now(); - - $claims = [ - RegisteredClaims::ISSUED_AT => $now->modify('-20 seconds'), - RegisteredClaims::NOT_BEFORE => $now->modify('+40 seconds'), - RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), - ]; - - $this->expectException(ConstraintViolation::class); - $this->expectExceptionMessage('The token cannot be used yet'); - - $constraint = new LooseValidAt($this->clock); - $constraint->assert($this->buildToken($claims)); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers ::assert - * @covers ::assertIssueTime - * - * @uses \Lcobucci\JWT\Token\DataSet - * @uses \Lcobucci\JWT\Token\Plain - * @uses \Lcobucci\JWT\Token\Signature - */ - public function assertShouldRaiseExceptionWhenTokenWasIssuedInTheFuture(): void - { - $now = $this->clock->now(); - - $claims = [ - RegisteredClaims::ISSUED_AT => $now->modify('+20 seconds'), - RegisteredClaims::NOT_BEFORE => $now->modify('+40 seconds'), - RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), - ]; - - $this->expectException(ConstraintViolation::class); - $this->expectExceptionMessage('The token was issued in the future'); - - $constraint = new LooseValidAt($this->clock); - $constraint->assert($this->buildToken($claims)); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers ::assert - * @covers ::assertExpiration - * @covers ::assertIssueTime - * @covers ::assertMinimumTime - * - * @uses \Lcobucci\JWT\Token\DataSet - * @uses \Lcobucci\JWT\Token\Plain - * @uses \Lcobucci\JWT\Token\Signature - */ - public function assertShouldNotRaiseExceptionWhenLeewayIsUsed(): void - { - $now = $this->clock->now(); - - $claims = [ - RegisteredClaims::ISSUED_AT => $now->modify('+5 seconds'), - RegisteredClaims::NOT_BEFORE => $now->modify('+5 seconds'), - RegisteredClaims::EXPIRATION_TIME => $now->modify('-5 seconds'), - ]; - - $constraint = new LooseValidAt($this->clock, new DateInterval('PT5S')); - $constraint->assert($this->buildToken($claims)); - - $this->addToAssertionCount(1); - } - - /** - * @test - * - * @covers ::__construct - * @covers ::guardLeeway - * @covers ::assert - * @covers ::assertExpiration - * @covers ::assertIssueTime - * @covers ::assertMinimumTime - * - * @uses \Lcobucci\JWT\Token\DataSet - * @uses \Lcobucci\JWT\Token\Plain - * @uses \Lcobucci\JWT\Token\Signature - */ - public function assertShouldNotRaiseExceptionWhenTokenIsUsedInTheRightMoment(): void - { - $constraint = new LooseValidAt($this->clock); - $now = $this->clock->now(); - - $token = $this->buildToken( - [ - RegisteredClaims::ISSUED_AT => $now->modify('-40 seconds'), - RegisteredClaims::NOT_BEFORE => $now->modify('-20 seconds'), - RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), - ] - ); - - $constraint->assert($token); - $this->addToAssertionCount(1); - - $token = $this->buildToken( - [ - RegisteredClaims::ISSUED_AT => $now, - RegisteredClaims::NOT_BEFORE => $now, - RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), - ] - ); - - $constraint->assert($token); - $this->addToAssertionCount(1); + return new LooseValidAt($clock, $leeway); } /** @@ -218,7 +32,7 @@ public function assertShouldNotRaiseExceptionWhenTokenIsUsedInTheRightMoment(): public function assertShouldNotRaiseExceptionWhenTokenDoesNotHaveTimeClaims(): void { $token = $this->buildToken(); - $constraint = new LooseValidAt($this->clock); + $constraint = $this->buildValidAtConstraint($this->clock); $constraint->assert($token); $this->addToAssertionCount(1); diff --git a/test/unit/Validation/Constraint/StrictValidAtTest.php b/test/unit/Validation/Constraint/StrictValidAtTest.php new file mode 100644 index 00000000..fb41bd28 --- /dev/null +++ b/test/unit/Validation/Constraint/StrictValidAtTest.php @@ -0,0 +1,117 @@ +expectException(ConstraintViolation::class); + $this->expectExceptionMessage('You should pass a plain token'); + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->createMock(Token::class)); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::assert + * @covers ::guardLeeway + * @covers ::assertIssueTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + public function assertShouldRaiseExceptionWhenIatClaimIsMissing(): void + { + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('"Issued At" claim missing'); + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken()); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::assert + * @covers ::guardLeeway + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + public function assertShouldRaiseExceptionWhenNbfClaimIsMissing(): void + { + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('"Not Before" claim missing'); + + $now = $this->clock->now(); + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('-5 seconds'), + ]; + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken($claims)); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::assert + * @covers ::guardLeeway + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * @covers ::assertExpiration + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + public function assertShouldRaiseExceptionWhenExpClaimIsMissing(): void + { + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('"Expiration Time" claim missing'); + + $now = $this->clock->now(); + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('-5 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('-5 seconds'), + ]; + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken($claims)); + } +} diff --git a/test/unit/Validation/Constraint/ValidAtTest.php b/test/unit/Validation/Constraint/ValidAtTest.php index 5ed3346d..321a4840 100644 --- a/test/unit/Validation/Constraint/ValidAtTest.php +++ b/test/unit/Validation/Constraint/ValidAtTest.php @@ -17,6 +17,11 @@ final class ValidAtTest extends ConstraintTestCase * * @covers ::__construct * @covers ::assert + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + * @uses \Lcobucci\JWT\Validation\Constraint\LooseValidAt */ public function assertIsAProxyToLooseValidAt(): void { diff --git a/test/unit/Validation/Constraint/ValidAtTestCase.php b/test/unit/Validation/Constraint/ValidAtTestCase.php new file mode 100644 index 00000000..65a32314 --- /dev/null +++ b/test/unit/Validation/Constraint/ValidAtTestCase.php @@ -0,0 +1,205 @@ +clock = new FrozenClock(new DateTimeImmutable()); + } + + abstract protected function buildValidAtConstraint(Clock $clock, ?DateInterval $leeway = null): Constraint; + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers \Lcobucci\JWT\Validation\Constraint\LeewayCannotBeNegative + */ + final public function constructShouldRaiseExceptionOnNegativeLeeway(): void + { + $leeway = new DateInterval('PT30S'); + $leeway->invert = 1; + + $this->expectException(LeewayCannotBeNegative::class); + $this->expectExceptionMessage('Leeway cannot be negative'); + + $this->buildValidAtConstraint($this->clock, $leeway); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers ::assert + * @covers ::assertExpiration + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + final public function assertShouldRaiseExceptionWhenTokenIsExpired(): void + { + $now = $this->clock->now(); + + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('-20 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('-10 seconds'), + RegisteredClaims::EXPIRATION_TIME => $now->modify('-10 seconds'), + ]; + + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('The token is expired'); + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken($claims)); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers ::assert + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + final public function assertShouldRaiseExceptionWhenMinimumTimeIsNotMet(): void + { + $now = $this->clock->now(); + + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('-20 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('+40 seconds'), + RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), + ]; + + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('The token cannot be used yet'); + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken($claims)); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers ::assert + * @covers ::assertIssueTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + final public function assertShouldRaiseExceptionWhenTokenWasIssuedInTheFuture(): void + { + $now = $this->clock->now(); + + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('+20 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('+40 seconds'), + RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), + ]; + + $this->expectException(ConstraintViolation::class); + $this->expectExceptionMessage('The token was issued in the future'); + + $constraint = $this->buildValidAtConstraint($this->clock); + $constraint->assert($this->buildToken($claims)); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers ::assert + * @covers ::assertExpiration + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + final public function assertShouldNotRaiseExceptionWhenLeewayIsUsed(): void + { + $now = $this->clock->now(); + + $claims = [ + RegisteredClaims::ISSUED_AT => $now->modify('+5 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('+5 seconds'), + RegisteredClaims::EXPIRATION_TIME => $now->modify('-5 seconds'), + ]; + + $constraint = $this->buildValidAtConstraint($this->clock, new DateInterval('PT5S')); + $constraint->assert($this->buildToken($claims)); + + $this->addToAssertionCount(1); + } + + /** + * @test + * + * @covers ::__construct + * @covers ::guardLeeway + * @covers ::assert + * @covers ::assertExpiration + * @covers ::assertIssueTime + * @covers ::assertMinimumTime + * + * @uses \Lcobucci\JWT\Token\DataSet + * @uses \Lcobucci\JWT\Token\Plain + * @uses \Lcobucci\JWT\Token\Signature + */ + final public function assertShouldNotRaiseExceptionWhenTokenIsUsedInTheRightMoment(): void + { + $constraint = $this->buildValidAtConstraint($this->clock); + $now = $this->clock->now(); + + $token = $this->buildToken( + [ + RegisteredClaims::ISSUED_AT => $now->modify('-40 seconds'), + RegisteredClaims::NOT_BEFORE => $now->modify('-20 seconds'), + RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), + ] + ); + + $constraint->assert($token); + $this->addToAssertionCount(1); + + $token = $this->buildToken( + [ + RegisteredClaims::ISSUED_AT => $now, + RegisteredClaims::NOT_BEFORE => $now, + RegisteredClaims::EXPIRATION_TIME => $now->modify('+60 seconds'), + ] + ); + + $constraint->assert($token); + $this->addToAssertionCount(1); + } +} From 0761d0c12b05d7046f78d39352b06cdd47f6cc39 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 1 Dec 2020 13:24:23 +0100 Subject: [PATCH 30/58] Document StrictValidAt constraint --- docs/validating-tokens.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index 3f5ca1b6..3a92510b 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -67,6 +67,7 @@ This library provides the following constraints: * `Lcobucci\JWT\Validation\Constraint\PermittedFor`: verifies if the claim `aud` contains the expected value * `Lcobucci\JWT\Validation\Constraint\RelatedTo`: verifies if the claim `sub` matches the expected value * `Lcobucci\JWT\Validation\Constraint\SignedWith`: verifies if the token was signed with the expected signer and key -* `Lcobucci\JWT\Validation\Constraint\LooseValidAt`: verifies the claims `iat`, `nbf`, and `exp` (supports leeway configuration) +* `Lcobucci\JWT\Validation\Constraint\StrictValidAt`: verifies presence and validity of the claims `iat`, `nbf`, and `exp` (supports leeway configuration) +* `Lcobucci\JWT\Validation\Constraint\LooseValidAt`: verifies the claims `iat`, `nbf`, and `exp`, when present (supports leeway configuration) You may also create your [own validation constraints](extending-the-library.md#validation-constraints). From 9c64c1739d9b8ceb1b919fbae3368ab6afef1d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Wed, 9 Dec 2020 11:35:14 +0100 Subject: [PATCH 31/58] Remove branch alias --- README.md | 6 +- composer.json | 5 - composer.lock | 356 ++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 337 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 7c87b1a2..1e30dd8e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Latest Stable Version]](https://packagist.org/packages/lcobucci/jwt) [![Unstable Version]](https://packagist.org/packages/lcobucci/jwt) -[![Build Status]](https://github.com/lcobucci/jwt/actions?query=workflow%3A%22PHPUnit%20Tests%22+branch%3Amaster) +[![Build Status]](https://github.com/lcobucci/jwt/actions?query=workflow%3A%22PHPUnit%20Tests%22+branch%3A4.1.x) [![Code Coverage]](https://codecov.io/gh/lcobucci/jwt) A simple library to work with JSON Web Token and JSON Web Signature based on the [RFC 7519](https://tools.ietf.org/html/rfc7519). @@ -32,5 +32,5 @@ free to check out Auth0's PHP SDK and free plan at [Total Downloads]: https://img.shields.io/packagist/dt/lcobucci/jwt.svg?style=flat-square [Latest Stable Version]: https://img.shields.io/packagist/v/lcobucci/jwt.svg?style=flat-square [Unstable Version]: https://img.shields.io/packagist/vpre/lcobucci/jwt.svg?style=flat-square -[Build Status]: https://img.shields.io/github/workflow/status/lcobucci/jwt/PHPUnit%20tests/master?style=flat-square -[Code Coverage]: https://codecov.io/gh/lcobucci/jwt/branch/master/graph/badge.svg +[Build Status]: https://img.shields.io/github/workflow/status/lcobucci/jwt/PHPUnit%20tests/4.1.x?style=flat-square +[Code Coverage]: https://codecov.io/gh/lcobucci/jwt/branch/4.1.x/graph/badge.svg diff --git a/composer.json b/composer.json index ff4c2271..caf371c5 100644 --- a/composer.json +++ b/composer.json @@ -53,10 +53,5 @@ "config": { "preferred-install": "dist", "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } } } diff --git a/composer.lock b/composer.lock index 0709ddf9..8d4d2bd0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "23679d7517bff66a508e93c193db939d", + "content-hash": "a5b117806eb1bb89e7ff3a840fe5343d", "packages": [ { "name": "lcobucci/clock", @@ -51,6 +51,10 @@ } ], "description": "Yet another clock abstraction", + "support": { + "issues": "https://github.com/lcobucci/clock/issues", + "source": "https://github.com/lcobucci/clock/tree/2.0.x" + }, "funding": [ { "url": "https://github.com/lcobucci", @@ -124,6 +128,10 @@ "assertion", "validation" ], + "support": { + "issues": "https://github.com/beberlei/assert/issues", + "source": "https://github.com/beberlei/assert/tree/v3.3.0" + }, "time": "2020-11-13T20:02:54+00:00" }, { @@ -168,6 +176,11 @@ "Xdebug", "performance" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + }, "funding": [ { "url": "https://packagist.com", @@ -248,6 +261,10 @@ "stylecheck", "tests" ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, "time": "2020-12-07T18:04:37+00:00" }, { @@ -319,6 +336,10 @@ "docblock", "parser" ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.11.1" + }, "time": "2020-10-26T10:28:16+00:00" }, { @@ -370,6 +391,10 @@ "standard", "style" ], + "support": { + "issues": "https://github.com/doctrine/coding-standard/issues", + "source": "https://github.com/doctrine/coding-standard/tree/8.2.0" + }, "time": "2020-10-25T14:56:19+00:00" }, { @@ -421,6 +446,10 @@ "constructor", "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -497,6 +526,10 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.1" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -552,6 +585,10 @@ } ], "description": "Abstract Test Framework Adapter for Infection", + "support": { + "issues": "https://github.com/infection/abstract-testframework-adapter/issues", + "source": "https://github.com/infection/abstract-testframework-adapter/tree/0.3" + }, "time": "2020-08-30T13:50:12+00:00" }, { @@ -604,6 +641,10 @@ } ], "description": "Infection Extension Installer", + "support": { + "issues": "https://github.com/infection/extension-installer/issues", + "source": "https://github.com/infection/extension-installer/tree/0.1.1" + }, "time": "2020-04-25T22:40:05+00:00" }, { @@ -646,6 +687,10 @@ } ], "description": "Stream Wrapper: Include Interceptor. Allows to replace included (autoloaded) file with another one.", + "support": { + "issues": "https://github.com/infection/include-interceptor/issues", + "source": "https://github.com/infection/include-interceptor/tree/0.2.4" + }, "time": "2020-08-07T22:40:37+00:00" }, { @@ -757,6 +802,10 @@ "testing", "unit testing" ], + "support": { + "issues": "https://github.com/infection/infection/issues", + "source": "https://github.com/infection/infection/tree/0.20.2" + }, "time": "2020-11-20T17:15:57+00:00" }, { @@ -823,6 +872,10 @@ "json", "schema" ], + "support": { + "issues": "https://github.com/justinrainbow/json-schema/issues", + "source": "https://github.com/justinrainbow/json-schema/tree/5.2.10" + }, "time": "2020-05-27T16:41:55+00:00" }, { @@ -858,6 +911,10 @@ } ], "description": "Lcobucci's Coding Standard", + "support": { + "issues": "https://github.com/lcobucci/coding-standard/issues", + "source": "https://github.com/lcobucci/coding-standard/tree/6.0.1" + }, "time": "2020-09-05T21:36:16+00:00" }, { @@ -1002,6 +1059,10 @@ "keywords": [ "functional" ], + "support": { + "issues": "https://github.com/lstrojny/functional-php/issues", + "source": "https://github.com/lstrojny/functional-php/tree/1.14.1" + }, "time": "2020-10-12T09:48:50+00:00" }, { @@ -1048,6 +1109,11 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", + "support": { + "issues": "https://github.com/bovigo/vfsStream/issues", + "source": "https://github.com/bovigo/vfsStream/tree/master", + "wiki": "https://github.com/bovigo/vfsStream/wiki" + }, "time": "2019-10-30T15:31:00+00:00" }, { @@ -1096,6 +1162,10 @@ "object", "object graph" ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", @@ -1154,41 +1224,42 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.3" + }, "time": "2020-12-03T17:45:45+00:00" }, { "name": "ocramius/package-versions", - "version": "1.9.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "94c9d42a466c57f91390cdd49c81313264f49d85" + "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/94c9d42a466c57f91390cdd49c81313264f49d85", - "reference": "94c9d42a466c57f91390cdd49c81313264f49d85", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a7e35c34bc166a5684a1e2f13da7b1d6a821349d", + "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7.4.0" + "composer-runtime-api": "^2.0.0", + "php": "^7.4.7 || ~8.0.0" + }, + "replace": { + "composer/package-versions-deprecated": "*" }, "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "doctrine/coding-standard": "^7.0.2", + "composer/composer": "^2.0.0@dev", + "doctrine/coding-standard": "^8.1.0", "ext-zip": "^1.15.0", - "infection/infection": "^0.15.3", - "phpunit/phpunit": "^9.1.1", - "vimeo/psalm": "^3.9.3" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.99.x-dev" - } + "infection/infection": "dev-master#8d6c4d6b15ec58d3190a78b7774a5d604ec1075a", + "phpunit/phpunit": "~9.3.11", + "vimeo/psalm": "^4.0.1" }, + "type": "library", "autoload": { "psr-4": { "PackageVersions\\": "src/PackageVersions" @@ -1204,7 +1275,11 @@ "email": "ocramius@gmail.com" } ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "description": "Provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/Ocramius/PackageVersions/issues", + "source": "https://github.com/Ocramius/PackageVersions/tree/2.1.0" + }, "funding": [ { "url": "https://github.com/Ocramius", @@ -1215,7 +1290,7 @@ "type": "tidelift" } ], - "time": "2020-06-22T14:15:44+00:00" + "time": "2020-10-21T13:48:04+00:00" }, { "name": "ondram/ci-detector", @@ -1283,6 +1358,10 @@ "teamcity", "travis" ], + "support": { + "issues": "https://github.com/OndraM/ci-detector/issues", + "source": "https://github.com/OndraM/ci-detector/tree/main" + }, "time": "2020-09-04T11:21:14+00:00" }, { @@ -1339,6 +1418,10 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, "time": "2020-06-27T14:33:11+00:00" }, { @@ -1386,6 +1469,10 @@ } ], "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.0.3" + }, "time": "2020-11-30T09:21:21+00:00" }, { @@ -1430,6 +1517,10 @@ } ], "description": "Simple, configurable, service container.", + "support": { + "issues": "https://github.com/phpbench/container/issues", + "source": "https://github.com/phpbench/container/tree/1.2.1" + }, "time": "2020-08-23T23:43:00+00:00" }, { @@ -1475,6 +1566,10 @@ } ], "description": "DOM wrapper to simplify working with the PHP DOM implementation", + "support": { + "issues": "https://github.com/phpbench/dom/issues", + "source": "https://github.com/phpbench/dom/tree/master" + }, "time": "2016-02-27T12:15:56+00:00" }, { @@ -1552,6 +1647,10 @@ } ], "description": "PHP Benchmarking Framework", + "support": { + "issues": "https://github.com/phpbench/phpbench/issues", + "source": "https://github.com/phpbench/phpbench/tree/master" + }, "time": "2020-06-13T11:59:17+00:00" }, { @@ -1601,6 +1700,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -1653,6 +1756,10 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, "time": "2020-09-03T19:13:55+00:00" }, { @@ -1698,6 +1805,10 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, "time": "2020-09-17T18:55:26+00:00" }, { @@ -1761,6 +1872,10 @@ "spy", "stub" ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.12.1" + }, "time": "2020-09-29T09:10:42+00:00" }, { @@ -1806,6 +1921,10 @@ "MIT" ], "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.0.5" + }, "time": "2020-08-30T12:06:42+00:00" }, { @@ -1855,6 +1974,10 @@ "MIT" ], "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/master" + }, "time": "2020-08-03T20:32:43+00:00" }, { @@ -1897,6 +2020,10 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/0.12.59" + }, "funding": [ { "url": "https://github.com/ondrejmirtes", @@ -1962,6 +2089,10 @@ "MIT" ], "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/0.12.5" + }, "time": "2020-07-21T14:52:30+00:00" }, { @@ -2018,6 +2149,10 @@ "MIT" ], "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.16" + }, "time": "2020-08-05T13:28:50+00:00" }, { @@ -2069,6 +2204,10 @@ "MIT" ], "description": "Extra strict and opinionated rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/master" + }, "time": "2020-08-30T15:42:06+00:00" }, { @@ -2136,6 +2275,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2192,6 +2335,10 @@ "filesystem", "iterator" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2251,6 +2398,10 @@ "keywords": [ "process" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2306,6 +2457,10 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2361,6 +2516,10 @@ "keywords": [ "timer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2456,6 +2615,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.0" + }, "funding": [ { "url": "https://phpunit.de/donate.html", @@ -2515,6 +2678,10 @@ "container-interop", "psr" ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/master" + }, "time": "2017-02-14T16:28:37+00:00" }, { @@ -2562,6 +2729,9 @@ "psr", "psr-3" ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -2617,6 +2787,10 @@ } ], "description": "General-purpose collections pipeline", + "support": { + "issues": "https://github.com/sanmai/pipeline/issues", + "source": "https://github.com/sanmai/pipeline/tree/v5.1.0" + }, "funding": [ { "url": "https://github.com/sanmai", @@ -2669,6 +2843,10 @@ ], "description": "Library for parsing CLI options", "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2721,6 +2899,10 @@ ], "description": "Collection of value objects that represent the PHP code units", "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2772,6 +2954,10 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2842,6 +3028,10 @@ "compare", "equality" ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2895,6 +3085,10 @@ ], "description": "Library for calculating the complexity of PHP code units", "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2957,6 +3151,10 @@ "unidiff", "unified diff" ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3016,6 +3214,10 @@ "environment", "hhvm" ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3089,6 +3291,10 @@ "export", "exporter" ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3149,6 +3355,10 @@ "keywords": [ "global state" ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3202,6 +3412,10 @@ ], "description": "Library for counting the lines of code in PHP source code", "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3255,6 +3469,10 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3306,6 +3524,10 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3365,6 +3587,10 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3416,6 +3642,10 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3468,6 +3698,10 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3517,6 +3751,10 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -3572,6 +3810,10 @@ "parser", "validator" ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" + }, "funding": [ { "url": "https://github.com/Seldaek", @@ -3629,6 +3871,10 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/6.4.1" + }, "funding": [ { "url": "https://github.com/kukulich", @@ -3690,6 +3936,11 @@ "phpcs", "standards" ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, "time": "2020-10-23T02:01:07+00:00" }, { @@ -3770,6 +4021,9 @@ "console", "terminal" ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3836,6 +4090,9 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.17" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3900,6 +4157,9 @@ ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/master" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3959,6 +4219,9 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4017,6 +4280,9 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4083,6 +4349,9 @@ "configuration", "options" ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4159,6 +4428,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4237,6 +4509,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4318,6 +4593,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4395,6 +4673,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4471,6 +4752,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4551,6 +4835,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4610,6 +4897,9 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4686,6 +4976,9 @@ "interoperability", "standards" ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/master" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4766,6 +5059,9 @@ "utf-8", "utf8" ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -4915,6 +5211,10 @@ "MIT" ], "description": "PHP core functions that throw exceptions instead of returning FALSE on error", + "support": { + "issues": "https://github.com/thecodingmachine/safe/issues", + "source": "https://github.com/thecodingmachine/safe/tree/v1.3.3" + }, "time": "2020-10-28T17:51:34+00:00" }, { @@ -4955,6 +5255,10 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, "funding": [ { "url": "https://github.com/theseer", @@ -5010,6 +5314,10 @@ "check", "validate" ], + "support": { + "issues": "https://github.com/webmozart/assert/issues", + "source": "https://github.com/webmozart/assert/tree/master" + }, "time": "2020-07-08T17:02:28+00:00" }, { @@ -5056,6 +5364,10 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, "time": "2015-12-17T08:42:14+00:00" } ], @@ -5070,5 +5382,5 @@ "ext-openssl": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } From 87af5b6ae13c72b9f1dbe5d4f5259a0405a80b2e Mon Sep 17 00:00:00 2001 From: hunomina Date: Thu, 10 Dec 2020 12:10:24 +0100 Subject: [PATCH 32/58] Fix typo in validating-tokens.md --- docs/validating-tokens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index 3a92510b..cc5cab3a 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -39,7 +39,7 @@ try { !!! Warning You **MUST** provide at least one constraint, otherwise `\Lcobucci\JWT\Validation\NoConstraintsGiven` exception will be thrown. -The difference here is that we'll always a get a `boolean` result and stop in the very first violation: +The difference here is that we'll always get a `boolean` result and stop in the very first violation: ```php use Lcobucci\JWT\Configuration; From a624f6d28a7b984348ecdb5478034c55c3e14140 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 10 Dec 2020 07:05:56 +0100 Subject: [PATCH 33/58] Implement EdDSA signer --- composer.json | 1 + composer.lock | 126 ++++++++++------------- src/Signer/Eddsa.php | 36 +++++++ test/_keys/Keys.php | 15 +++ test/functional/EddsaTokenTest.php | 141 +++++++++++++++++++++++++ test/performance/EddsaBench.php | 30 ++++++ test/unit/Signer/EddsaTest.php | 160 +++++++++++++++++++++++++++++ 7 files changed, 438 insertions(+), 71 deletions(-) create mode 100644 src/Signer/Eddsa.php create mode 100644 test/functional/EddsaTokenTest.php create mode 100644 test/performance/EddsaBench.php create mode 100644 test/unit/Signer/EddsaTest.php diff --git a/composer.json b/composer.json index caf371c5..7c4de336 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "php": "^7.4 || ^8.0", "ext-mbstring": "*", "ext-openssl": "*", + "ext-sodium": "*", "lcobucci/clock": "^2.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 8d4d2bd0..524817a7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a5b117806eb1bb89e7ff3a840fe5343d", + "content-hash": "99b614c2697176da1b4a143a0d1ef993", "packages": [ { "name": "lcobucci/clock", @@ -1426,16 +1426,16 @@ }, { "name": "phar-io/version", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae" + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/726c026815142e4f8677b7cb7f2249c9ffb7ecae", - "reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { @@ -1471,9 +1471,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.3" + "source": "https://github.com/phar-io/version/tree/3.0.4" }, - "time": "2020-11-30T09:21:21+00:00" + "time": "2020-12-13T23:18:30+00:00" }, { "name": "phpbench/container", @@ -1880,16 +1880,16 @@ }, { "name": "phpstan/extension-installer", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "5c2da3846819f951385cb6a25d3277051481c48a" + "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/5c2da3846819f951385cb6a25d3277051481c48a", - "reference": "5c2da3846819f951385cb6a25d3277051481c48a", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051", "shasum": "" }, "require": { @@ -1899,13 +1899,9 @@ }, "require-dev": { "composer/composer": "^1.8", - "consistence/coding-standard": "^3.8", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.0.2", - "phing/phing": "^2.16", + "phing/phing": "^2.16.3", "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11", - "slevomat/coding-standard": "^5.0.4" + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12" }, "type": "composer-plugin", "extra": { @@ -1923,9 +1919,9 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.0.5" + "source": "https://github.com/phpstan/extension-installer/tree/1.1.0" }, - "time": "2020-08-30T12:06:42+00:00" + "time": "2020-12-13T13:06:13+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -1982,16 +1978,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.59", + "version": "0.12.63", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779" + "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cf4107257c8ca2ad967efdd6a00f12b21acbb779", - "reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c97ec4754bd53099a06c24847bd2870b99966b6a", + "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a", "shasum": "" }, "require": { @@ -2022,7 +2018,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.59" + "source": "https://github.com/phpstan/phpstan/tree/0.12.63" }, "funding": [ { @@ -2038,35 +2034,31 @@ "type": "tidelift" } ], - "time": "2020-12-07T14:46:03+00:00" + "time": "2020-12-15T16:37:16+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "0.12.5", + "version": "0.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "bfabc6a1b4617fbcbff43f03a4c04eae9bafae21" + "reference": "46dbd43c2db973d2876d6653e53f5c2cc3a01fbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/bfabc6a1b4617fbcbff43f03a4c04eae9bafae21", - "reference": "bfabc6a1b4617fbcbff43f03a4c04eae9bafae21", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/46dbd43c2db973d2876d6653e53f5c2cc3a01fbb", + "reference": "46dbd43c2db973d2876d6653e53f5c2cc3a01fbb", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.26" + "phpstan/phpstan": "^0.12.60" }, "require-dev": { - "consistence/coding-standard": "^3.0.1", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.0.2", - "jakub-onderka/php-parallel-lint": "^1.0", - "phing/phing": "^2.16.0", + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0", - "slevomat/coding-standard": "^4.5.2" + "phpunit/phpunit": "^7.5.20" }, "type": "phpstan-extension", "extra": { @@ -2091,41 +2083,36 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/0.12.5" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/0.12.6" }, - "time": "2020-07-21T14:52:30+00:00" + "time": "2020-12-13T10:20:54+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "0.12.16", + "version": "0.12.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "1dd916d181b0539dea5cd37e91546afb8b107e17" + "reference": "432575b41cf2d4f44e460234acaf56119ed97d36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/1dd916d181b0539dea5cd37e91546afb8b107e17", - "reference": "1dd916d181b0539dea5cd37e91546afb8b107e17", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/432575b41cf2d4f44e460234acaf56119ed97d36", + "reference": "432575b41cf2d4f44e460234acaf56119ed97d36", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.33" + "phpstan/phpstan": "^0.12.60" }, "conflict": { "phpunit/phpunit": "<7.0" }, "require-dev": { - "consistence/coding-standard": "^3.5", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.0.2", - "jakub-onderka/php-parallel-lint": "^1.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "satooshi/php-coveralls": "^1.0", - "slevomat/coding-standard": "^4.7.2" + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-strict-rules": "^0.12.6", + "phpunit/phpunit": "^7.5.20" }, "type": "phpstan-extension", "extra": { @@ -2151,37 +2138,33 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.16" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.17" }, - "time": "2020-08-05T13:28:50+00:00" + "time": "2020-12-13T12:12:51+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "0.12.5", + "version": "0.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "334898a32217e4605e0f9cfa3d3fc3101bda26be" + "reference": "03807e3410747ec18cd5f05a6342384adcc423bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/334898a32217e4605e0f9cfa3d3fc3101bda26be", - "reference": "334898a32217e4605e0f9cfa3d3fc3101bda26be", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/03807e3410747ec18cd5f05a6342384adcc423bf", + "reference": "03807e3410747ec18cd5f05a6342384adcc423bf", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.33" + "phpstan/phpstan": "^0.12.60" }, "require-dev": { - "consistence/coding-standard": "^3.0.1", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.0.2", - "jakub-onderka/php-parallel-lint": "^1.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0", - "slevomat/coding-standard": "^4.5.2" + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^0.12.16", + "phpunit/phpunit": "^7.5.20" }, "type": "phpstan-extension", "extra": { @@ -2206,9 +2189,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/master" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.7" }, - "time": "2020-08-30T15:42:06+00:00" + "time": "2020-12-13T13:27:14+00:00" }, { "name": "phpunit/php-code-coverage", @@ -5379,7 +5362,8 @@ "platform": { "php": "^7.4 || ^8.0", "ext-mbstring": "*", - "ext-openssl": "*" + "ext-openssl": "*", + "ext-sodium": "*" }, "platform-dev": [], "plugin-api-version": "2.0.0" diff --git a/src/Signer/Eddsa.php b/src/Signer/Eddsa.php new file mode 100644 index 00000000..03ad88bd --- /dev/null +++ b/src/Signer/Eddsa.php @@ -0,0 +1,36 @@ +contents()); + } catch (SodiumException $sodiumException) { + throw new InvalidKeyProvided($sodiumException->getMessage(), 0, $sodiumException); + } + } + + public function verify(string $expected, string $payload, Key $key): bool + { + try { + return sodium_crypto_sign_verify_detached($expected, $payload, $key->contents()); + } catch (SodiumException $sodiumException) { + throw new InvalidKeyProvided($sodiumException->getMessage(), 0, $sodiumException); + } + } +} diff --git a/test/_keys/Keys.php b/test/_keys/Keys.php index 87737230..93db8224 100644 --- a/test/_keys/Keys.php +++ b/test/_keys/Keys.php @@ -14,6 +14,9 @@ trait Keys /** @var array */ protected static array $ecdsaKeys; + /** @var array */ + protected static array $eddsaKeys; + /** @beforeClass */ public static function createRsaKeys(): void { @@ -39,4 +42,16 @@ public static function createEcdsaKeys(): void 'public2_ec512' => LocalFileReference::file(__DIR__ . '/ecdsa/public2_ec512.key'), ]; } + + /** @beforeClass */ + public static function createEddsaKeys(): void + { + static::$eddsaKeys = [ + 'private' => Key\InMemory::base64Encoded( + 'K3NWT0XqaH+4jgi42gQmHnFE+HTPVhFYi3u4DFJ3OpRHRMt/aGRBoKD/Pt5H/iYgGCla7Q04CdjOUpLSrjZhtg==' + ), + 'public1' => Key\InMemory::base64Encoded('R0TLf2hkQaCg/z7eR/4mIBgpWu0NOAnYzlKS0q42YbY='), + 'public2' => Key\InMemory::base64Encoded('8uLLzCdMrIWcOrAxS/fteYyJhWIGH+wav2fNz8NZhvI='), + ]; + } } diff --git a/test/functional/EddsaTokenTest.php b/test/functional/EddsaTokenTest.php new file mode 100644 index 00000000..957bfb53 --- /dev/null +++ b/test/functional/EddsaTokenTest.php @@ -0,0 +1,141 @@ +config = Configuration::forAsymmetricSigner( + new Eddsa(), + static::$eddsaKeys['private'], + static::$eddsaKeys['public1'] + ); + } + + /** @test */ + public function builderShouldRaiseExceptionWhenKeyIsInvalid(): void + { + $builder = $this->config->builder(); + + $this->expectException(InvalidKeyProvided::class); + $this->expectExceptionMessage('SODIUM_CRYPTO_SIGN_SECRETKEYBYTES'); + + $builder->identifiedBy('1') + ->permittedFor('http://client.abc.com') + ->issuedBy('http://api.abc.com') + ->withClaim('user', ['name' => 'testing', 'email' => 'testing@abc.com']) + ->getToken($this->config->signer(), InMemory::plainText('testing')); + } + + /** @test */ + public function builderCanGenerateAToken(): Token + { + $user = ['name' => 'testing', 'email' => 'testing@abc.com']; + $builder = $this->config->builder(); + + $token = $builder->identifiedBy('1') + ->permittedFor('http://client.abc.com') + ->permittedFor('http://client2.abc.com') + ->issuedBy('http://api.abc.com') + ->withClaim('user', $user) + ->withHeader('jki', '1234') + ->getToken($this->config->signer(), $this->config->signingKey()); + + self::assertEquals('1234', $token->headers()->get('jki')); + self::assertEquals('http://api.abc.com', $token->claims()->get(Token\RegisteredClaims::ISSUER)); + self::assertEquals($user, $token->claims()->get('user')); + + self::assertEquals( + ['http://client.abc.com', 'http://client2.abc.com'], + $token->claims()->get(Token\RegisteredClaims::AUDIENCE) + ); + + return $token; + } + + /** + * @test + * @depends builderCanGenerateAToken + */ + public function parserCanReadAToken(Token $generated): void + { + $read = $this->config->parser()->parse($generated->toString()); + assert($read instanceof Token\Plain); + + self::assertEquals($generated, $read); + self::assertEquals('testing', $read->claims()->get('user')['name']); + } + + /** + * @test + * @depends builderCanGenerateAToken + */ + public function signatureAssertionShouldRaiseExceptionWhenKeyIsNotRight(Token $token): void + { + $this->expectException(RequiredConstraintsViolated::class); + $this->expectExceptionMessage('The token violates some mandatory constraints'); + + $this->config->validator()->assert( + $token, + new SignedWith( + $this->config->signer(), + self::$eddsaKeys['public2'] + ) + ); + } + + /** + * @test + * @depends builderCanGenerateAToken + */ + public function signatureValidationShouldSucceedWhenKeyIsRight(Token $token): void + { + $constraint = new SignedWith( + $this->config->signer(), + $this->config->verificationKey() + ); + + self::assertTrue($this->config->validator()->validate($token, $constraint)); + } +} diff --git a/test/performance/EddsaBench.php b/test/performance/EddsaBench.php new file mode 100644 index 00000000..3d94cdee --- /dev/null +++ b/test/performance/EddsaBench.php @@ -0,0 +1,30 @@ +getSigner()->algorithmId()); + } + + /** + * @test + * + * @covers ::sign + * + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function signShouldReturnAValidEddsaSignature(): void + { + $payload = 'testing'; + + $signer = $this->getSigner(); + $signature = $signer->sign($payload, self::$eddsaKeys['private']); + + $publicKey = self::$eddsaKeys['public1']->contents(); + + self::assertTrue(sodium_crypto_sign_verify_detached($signature, $payload, $publicKey)); + } + + /** + * @test + * + * @covers ::sign + * + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function signShouldRaiseAnExceptionWhenKeyIsInvalid(): void + { + $signer = $this->getSigner(); + + $this->expectException(InvalidKeyProvided::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('SODIUM_CRYPTO_SIGN_SECRETKEYBYTES'); + + $signer->sign('testing', InMemory::plainText('tooshort')); + } + + /** + * @test + * + * @covers ::verify + * + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function verifyShouldReturnTrueWhenSignatureIsValid(): void + { + $payload = 'testing'; + $signature = sodium_crypto_sign_detached($payload, self::$eddsaKeys['private']->contents()); + + $signer = $this->getSigner(); + + self::assertTrue($signer->verify($signature, $payload, self::$eddsaKeys['public1'])); + } + + /** + * @test + * + * @covers ::verify + * + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function verifyShouldRaiseAnExceptionWhenKeyIsNotParseable(): void + { + $signer = $this->getSigner(); + + $this->expectException(InvalidKeyProvided::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('SODIUM_CRYPTO_SIGN_BYTES'); + + $signer->verify('testing', 'testing', InMemory::plainText('blablabla')); + } + + /** + * @see https://tools.ietf.org/html/rfc8037#appendix-A.4 + * + * @test + * + * @covers ::sign + * + * @uses \Lcobucci\JWT\Encoding\JoseEncoder + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function signatureOfRfcExample(): void + { + $signer = $this->getSigner(); + $encoder = new JoseEncoder(); + + $key = InMemory::plainText( + $encoder->base64UrlDecode('nWGxne_9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A') + . $encoder->base64UrlDecode('11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo') + ); + $payload = $encoder->base64UrlEncode('{"alg":"EdDSA"}') + . '.' + . $encoder->base64UrlEncode('Example of Ed25519 signing'); + $signature = $signer->sign($payload, $key); + + self::assertSame('eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc', $payload); + self::assertSame( + 'hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_MuM0KAg', + $encoder->base64UrlEncode($signature) + ); + } + + /** + * @see https://tools.ietf.org/html/rfc8037#appendix-A.5 + * + * @test + * + * @covers ::verify + * + * @uses \Lcobucci\JWT\Encoding\JoseEncoder + * @uses \Lcobucci\JWT\Signer\Key\InMemory + */ + public function verificationOfRfcExample(): void + { + $signer = $this->getSigner(); + $encoder = new JoseEncoder(); + + $key = InMemory::plainText($encoder->base64UrlDecode('11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo')); + $payload = 'eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc'; + $signature = $encoder->base64UrlDecode( + 'hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_MuM0KAg' + ); + + self::assertTrue($signer->verify($signature, $payload, $key)); + } + + private function getSigner(): Eddsa + { + return new Eddsa(); + } +} From ff0710207844e4b93ec086b2eeb94f6990cd92c1 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 10 Dec 2020 08:06:31 +0100 Subject: [PATCH 34/58] Add documentation --- docs/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 428acd82..72a7c85a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -82,7 +82,7 @@ use Lcobucci\JWT\Signer\Key\LocalFileReference; use Lcobucci\JWT\Signer\Key\InMemory; $configuration = Configuration::forAsymmetricSigner( - // You may use RSA or ECDSA and all their variations (256, 384, and 512) + // You may use RSA or ECDSA and all their variations (256, 384, and 512) and EdDSA over Curve25519 new Signer\Rsa\Sha256(), LocalFileReference::file(__DIR__ . '/my-private-key.pem'), InMemory::base64Encoded('mBC5v1sOKVvbdEitdSBenu59nfNfhwkedkJVNabosTw=') From f5e3432749cab4188f02e0171e4fa028d2c5994b Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 17 Dec 2020 07:57:27 +0100 Subject: [PATCH 35/58] Prefer ext-sodium cache-timing-safe functions --- src/Encoding/JoseEncoder.php | 20 ++++++++------------ src/Signer/Key/InMemory.php | 11 +++++++---- test/performance/Hmac/HmacBench.php | 2 +- test/unit/Encoding/JoseEncoderTest.php | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Encoding/JoseEncoder.php b/src/Encoding/JoseEncoder.php index 9cb49c42..68da5781 100644 --- a/src/Encoding/JoseEncoder.php +++ b/src/Encoding/JoseEncoder.php @@ -6,18 +6,17 @@ use JsonException; use Lcobucci\JWT\Decoder; use Lcobucci\JWT\Encoder; +use SodiumException; -use function base64_decode; -use function base64_encode; -use function is_string; use function json_decode; use function json_encode; -use function rtrim; -use function strtr; +use function sodium_base642bin; +use function sodium_bin2base64; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; use const JSON_UNESCAPED_UNICODE; +use const SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING; /** * A utilitarian class that encodes and decodes data according with JOSE specifications @@ -48,18 +47,15 @@ public function jsonDecode(string $json) public function base64UrlEncode(string $data): string { - return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); + return sodium_bin2base64($data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING); } public function base64UrlDecode(string $data): string { - // Padding isn't added back because it isn't strictly necessary for decoding with PHP - $decodedContent = base64_decode(strtr($data, '-_', '+/'), true); - - if (! is_string($decodedContent)) { + try { + return sodium_base642bin($data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, ''); + } catch (SodiumException $sodiumException) { throw CannotDecodeContent::invalidBase64String(); } - - return $decodedContent; } } diff --git a/src/Signer/Key/InMemory.php b/src/Signer/Key/InMemory.php index 2dbe9916..dd915515 100644 --- a/src/Signer/Key/InMemory.php +++ b/src/Signer/Key/InMemory.php @@ -5,12 +5,15 @@ use Lcobucci\JWT\Encoding\CannotDecodeContent; use Lcobucci\JWT\Signer\Key; +use SodiumException; use SplFileObject; use Throwable; use function assert; -use function base64_decode; use function is_string; +use function sodium_base642bin; + +use const SODIUM_BASE64_VARIANT_ORIGINAL; final class InMemory implements Key { @@ -35,9 +38,9 @@ public static function plainText(string $contents, string $passphrase = ''): sel public static function base64Encoded(string $contents, string $passphrase = ''): self { - $decoded = base64_decode($contents, true); - - if ($decoded === false) { + try { + $decoded = sodium_base642bin($contents, SODIUM_BASE64_VARIANT_ORIGINAL, ''); + } catch (SodiumException $sodiumException) { throw CannotDecodeContent::invalidBase64String(); } diff --git a/test/performance/Hmac/HmacBench.php b/test/performance/Hmac/HmacBench.php index 471928ae..4fe35c5a 100644 --- a/test/performance/Hmac/HmacBench.php +++ b/test/performance/Hmac/HmacBench.php @@ -11,7 +11,7 @@ /** @Groups({"Hmac"}) */ abstract class HmacBench extends SignerBench { - private const ENCODED_KEY = 'hJtXIZ2uSN5kbQfbtTNWbpdmhkV8FJG+Onbc6mxCcYg'; + private const ENCODED_KEY = 'hJtXIZ2uSN5kbQfbtTNWbpdmhkV8FJG+Onbc6mxCcYg='; protected function signingKey(): Key { diff --git a/test/unit/Encoding/JoseEncoderTest.php b/test/unit/Encoding/JoseEncoderTest.php index 12db5a36..32f28ea0 100644 --- a/test/unit/Encoding/JoseEncoderTest.php +++ b/test/unit/Encoding/JoseEncoderTest.php @@ -148,7 +148,7 @@ public function base64UrlDecodeMustRaiseExceptionWhenInvalidBase64CharsAreUsed() $this->expectExceptionCode(0); $this->expectExceptionMessage('Error while decoding from Base64Url, invalid base64 characters detected'); - $decoder->base64UrlDecode('áááááá'); + $decoder->base64UrlDecode('ááá'); } /** From bfb940b5d10a5c3d7a71df632d13e35c47370218 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 17 Dec 2020 10:26:55 +0100 Subject: [PATCH 36/58] Rethrow SodiumException --- src/Encoding/CannotDecodeContent.php | 5 +++-- src/Encoding/JoseEncoder.php | 2 +- src/Signer/Key/InMemory.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Encoding/CannotDecodeContent.php b/src/Encoding/CannotDecodeContent.php index 8363061a..33607b11 100644 --- a/src/Encoding/CannotDecodeContent.php +++ b/src/Encoding/CannotDecodeContent.php @@ -6,6 +6,7 @@ use JsonException; use Lcobucci\JWT\Exception; use RuntimeException; +use SodiumException; final class CannotDecodeContent extends RuntimeException implements Exception { @@ -14,8 +15,8 @@ public static function jsonIssues(JsonException $previous): self return new self('Error while decoding from JSON', 0, $previous); } - public static function invalidBase64String(): self + public static function invalidBase64String(SodiumException $sodiumException): self { - return new self('Error while decoding from Base64Url, invalid base64 characters detected'); + return new self('Error while decoding from Base64Url, invalid base64 characters detected', 0, $sodiumException); } } diff --git a/src/Encoding/JoseEncoder.php b/src/Encoding/JoseEncoder.php index 68da5781..4d8fc241 100644 --- a/src/Encoding/JoseEncoder.php +++ b/src/Encoding/JoseEncoder.php @@ -55,7 +55,7 @@ public function base64UrlDecode(string $data): string try { return sodium_base642bin($data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, ''); } catch (SodiumException $sodiumException) { - throw CannotDecodeContent::invalidBase64String(); + throw CannotDecodeContent::invalidBase64String($sodiumException); } } } diff --git a/src/Signer/Key/InMemory.php b/src/Signer/Key/InMemory.php index dd915515..2b62edae 100644 --- a/src/Signer/Key/InMemory.php +++ b/src/Signer/Key/InMemory.php @@ -41,7 +41,7 @@ public static function base64Encoded(string $contents, string $passphrase = ''): try { $decoded = sodium_base642bin($contents, SODIUM_BASE64_VARIANT_ORIGINAL, ''); } catch (SodiumException $sodiumException) { - throw CannotDecodeContent::invalidBase64String(); + throw CannotDecodeContent::invalidBase64String($sodiumException); } return new self($decoded, $passphrase); From c3cb5fb59916485c411175e93dda3b30592b51c4 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 17 Dec 2020 08:17:49 +0100 Subject: [PATCH 37/58] Activate composer.json check in CI --- .gitattributes | 25 ++++----- .github/workflows/composer-json-lint.yml | 65 ++++++++++++++++++++++++ composer-require-checker.json | 7 +++ 3 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/composer-json-lint.yml create mode 100644 composer-require-checker.json diff --git a/.gitattributes b/.gitattributes index 94213456..cb903a56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,13 @@ -/docs export-ignore -/test export-ignore -/.gitattributes export-ignore -/.github export-ignore -/.gitignore export-ignore -/*.yml export-ignore -/CONTRIBUTING.md export-ignore -/*.dist export-ignore -/phpbench.json export-ignore -/composer.lock export-ignore -/README.md export-ignore -/Makefile export-ignore +/docs export-ignore +/test export-ignore +/.gitattributes export-ignore +/.github export-ignore +/.gitignore export-ignore +/*.yml export-ignore +/CONTRIBUTING.md export-ignore +/*.dist export-ignore +/phpbench.json export-ignore +/composer.lock export-ignore +/README.md export-ignore +/Makefile export-ignore +/composer-require-checker.json export-ignore diff --git a/.github/workflows/composer-json-lint.yml b/.github/workflows/composer-json-lint.yml new file mode 100644 index 00000000..949e3918 --- /dev/null +++ b/.github/workflows/composer-json-lint.yml @@ -0,0 +1,65 @@ +name: "Lint composer.json" + +on: + pull_request: + push: + +jobs: + coding-standards: + name: "Lint composer.json" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "highest" + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: composer:v2, composer-normalize, composer-require-checker, composer-unused + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress" + + - name: "Validate composer.json" + run: "composer validate --strict" + + - name: "Normalize composer.json" + run: "composer-normalize --dry-run" + + - name: "Check composer.json explicit dependencies" + run: "composer-require-checker check --config-file=$(realpath composer-require-checker.json)" + + - name: "Check composer.json unused dependencies" + run: "composer-unused" diff --git a/composer-require-checker.json b/composer-require-checker.json new file mode 100644 index 00000000..5d0e97f8 --- /dev/null +++ b/composer-require-checker.json @@ -0,0 +1,7 @@ +{ + "symbol-whitelist" : [ + "null", "true", "false", + "static", "self", "parent", + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object" + ] +} From b6f055e5b5c2eaf3b8159c148b517dc2520b9c47 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 17 Dec 2020 08:18:45 +0100 Subject: [PATCH 38/58] composer-normalize --- composer.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 7c4de336..51cbe8c0 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,7 @@ { "name": "lcobucci/jwt", - "description": "A simple library to work with JSON Web Token and JSON Web Signature", "type": "library", - "authors": [ - { - "name": "Luís Cobucci", - "email": "lcobucci@gmail.com", - "role": "Developer" - } - ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", "keywords": [ "JWT", "JWS" @@ -16,6 +9,13 @@ "license": [ "BSD-3-Clause" ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], "require": { "php": "^7.4 || ^8.0", "ext-mbstring": "*", @@ -36,6 +36,10 @@ "phpunit/php-invoker": "^3.1", "phpunit/phpunit": "^9.5" }, + "config": { + "preferred-install": "dist", + "sort-packages": true + }, "autoload": { "psr-4": { "Lcobucci\\JWT\\": "src" @@ -50,9 +54,5 @@ ], "Lcobucci\\JWT\\FunctionalTests\\": "test/functional" } - }, - "config": { - "preferred-install": "dist", - "sort-packages": true } } From 4d86c24631b20467bea95fd9068a885401739721 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 17 Dec 2020 08:19:47 +0100 Subject: [PATCH 39/58] composer-require-checker --- composer-require-checker.json | 3 ++- composer.json | 2 ++ composer.lock | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/composer-require-checker.json b/composer-require-checker.json index 5d0e97f8..3d3e56d1 100644 --- a/composer-require-checker.json +++ b/composer-require-checker.json @@ -2,6 +2,7 @@ "symbol-whitelist" : [ "null", "true", "false", "static", "self", "parent", - "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object" + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", + "OpenSSLAsymmetricKey" ] } diff --git a/composer.json b/composer.json index 51cbe8c0..28765557 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,8 @@ ], "require": { "php": "^7.4 || ^8.0", + "ext-hash": "*", + "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", "ext-sodium": "*", diff --git a/composer.lock b/composer.lock index 524817a7..7a0657eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "99b614c2697176da1b4a143a0d1ef993", + "content-hash": "2dc31d2b3c358993b89dba8e31a661e7", "packages": [ { "name": "lcobucci/clock", @@ -5361,6 +5361,8 @@ "prefer-lowest": false, "platform": { "php": "^7.4 || ^8.0", + "ext-hash": "*", + "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", "ext-sodium": "*" From 484225637b50f42e64eade1dee130668a97daa40 Mon Sep 17 00:00:00 2001 From: Thomas LE BERRE <29512640+t0mmy742@users.noreply.github.com> Date: Tue, 29 Dec 2020 00:53:36 +0100 Subject: [PATCH 40/58] Update phpbench to match PHP 8 requirements --- composer.json | 2 +- composer.lock | 396 ++++++++++++-------------------------------------- 2 files changed, 93 insertions(+), 305 deletions(-) diff --git a/composer.json b/composer.json index 28765557..ee9b2f83 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "infection/infection": "^0.20", "lcobucci/coding-standard": "^6.0", "mikey179/vfsstream": "^1.6", - "phpbench/phpbench": "^0.17", + "phpbench/phpbench": "^1.0@alpha", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-deprecation-rules": "^0.12", diff --git a/composer.lock b/composer.lock index 7a0657eb..184911f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2dc31d2b3c358993b89dba8e31a661e7", + "content-hash": "1dfa158f0ebfc4a67352f7e88501d34c", "packages": [ { "name": "lcobucci/clock", @@ -917,154 +917,6 @@ }, "time": "2020-09-05T21:36:16+00:00" }, - { - "name": "lstrojny/functional-php", - "version": "1.14.1", - "source": { - "type": "git", - "url": "https://github.com/lstrojny/functional-php.git", - "reference": "9e8363e3cb9db924327f51b5804f4dfba03605aa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/lstrojny/functional-php/zipball/9e8363e3cb9db924327f51b5804f4dfba03605aa", - "reference": "9e8363e3cb9db924327f51b5804f4dfba03605aa", - "shasum": "" - }, - "require": { - "php": "~7" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.14", - "phpunit/phpunit": "~7", - "squizlabs/php_codesniffer": "~3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Functional\\": "src/Functional" - }, - "files": [ - "src/Functional/Ary.php", - "src/Functional/Average.php", - "src/Functional/ButLast.php", - "src/Functional/Capture.php", - "src/Functional/ConstFunction.php", - "src/Functional/CompareOn.php", - "src/Functional/CompareObjectHashOn.php", - "src/Functional/Compose.php", - "src/Functional/Concat.php", - "src/Functional/Contains.php", - "src/Functional/Converge.php", - "src/Functional/Curry.php", - "src/Functional/CurryN.php", - "src/Functional/Difference.php", - "src/Functional/DropFirst.php", - "src/Functional/DropLast.php", - "src/Functional/Each.php", - "src/Functional/Equal.php", - "src/Functional/ErrorToException.php", - "src/Functional/Every.php", - "src/Functional/False.php", - "src/Functional/Falsy.php", - "src/Functional/Filter.php", - "src/Functional/First.php", - "src/Functional/FirstIndexOf.php", - "src/Functional/FlatMap.php", - "src/Functional/Flatten.php", - "src/Functional/Flip.php", - "src/Functional/GreaterThan.php", - "src/Functional/GreaterThanOrEqual.php", - "src/Functional/Group.php", - "src/Functional/Head.php", - "src/Functional/Id.php", - "src/Functional/IfElse.php", - "src/Functional/Identical.php", - "src/Functional/IndexesOf.php", - "src/Functional/Intersperse.php", - "src/Functional/Invoke.php", - "src/Functional/InvokeFirst.php", - "src/Functional/InvokeIf.php", - "src/Functional/InvokeLast.php", - "src/Functional/Invoker.php", - "src/Functional/Last.php", - "src/Functional/LastIndexOf.php", - "src/Functional/LessThan.php", - "src/Functional/LessThanOrEqual.php", - "src/Functional/LexicographicCompare.php", - "src/Functional/Map.php", - "src/Functional/Matching.php", - "src/Functional/Maximum.php", - "src/Functional/Memoize.php", - "src/Functional/Minimum.php", - "src/Functional/None.php", - "src/Functional/Noop.php", - "src/Functional/Not.php", - "src/Functional/OmitKeys.php", - "src/Functional/PartialAny.php", - "src/Functional/PartialLeft.php", - "src/Functional/PartialMethod.php", - "src/Functional/PartialRight.php", - "src/Functional/Partition.php", - "src/Functional/Pick.php", - "src/Functional/Pluck.php", - "src/Functional/Poll.php", - "src/Functional/Product.php", - "src/Functional/Ratio.php", - "src/Functional/ReduceLeft.php", - "src/Functional/ReduceRight.php", - "src/Functional/Reindex.php", - "src/Functional/Reject.php", - "src/Functional/Repeat.php", - "src/Functional/Retry.php", - "src/Functional/Select.php", - "src/Functional/SelectKeys.php", - "src/Functional/SequenceConstant.php", - "src/Functional/SequenceExponential.php", - "src/Functional/SequenceLinear.php", - "src/Functional/Some.php", - "src/Functional/Sort.php", - "src/Functional/Sum.php", - "src/Functional/SuppressError.php", - "src/Functional/Tap.php", - "src/Functional/Tail.php", - "src/Functional/TailRecursion.php", - "src/Functional/TakeLeft.php", - "src/Functional/TakeRight.php", - "src/Functional/True.php", - "src/Functional/Truthy.php", - "src/Functional/Unique.php", - "src/Functional/ValueToKey.php", - "src/Functional/With.php", - "src/Functional/Zip.php", - "src/Functional/ZipAll.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Lars Strojny", - "email": "lstrojny@php.net", - "homepage": "http://usrportage.de" - }, - { - "name": "Max Beutel", - "email": "nash12@gmail.com" - } - ], - "description": "Functional primitives for PHP", - "keywords": [ - "functional" - ], - "support": { - "issues": "https://github.com/lstrojny/functional-php/issues", - "source": "https://github.com/lstrojny/functional-php/tree/1.14.1" - }, - "time": "2020-10-12T09:48:50+00:00" - }, { "name": "mikey179/vfsstream", "version": "v1.6.8", @@ -1176,16 +1028,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.3", + "version": "v4.10.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", - "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", "shasum": "" }, "require": { @@ -1226,9 +1078,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" }, - "time": "2020-12-03T17:45:45+00:00" + "time": "2020-12-20T10:01:03+00:00" }, { "name": "ocramius/package-versions", @@ -1477,28 +1329,31 @@ }, { "name": "phpbench/container", - "version": "1.2.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phpbench/container.git", - "reference": "2f2b269b3b8cb9a0053cf98f1c3a84866fe7f0e2" + "reference": "04054b7c8cb30f948e5a289601c34834db58aa9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpbench/container/zipball/2f2b269b3b8cb9a0053cf98f1c3a84866fe7f0e2", - "reference": "2f2b269b3b8cb9a0053cf98f1c3a84866fe7f0e2", + "url": "https://api.github.com/repos/phpbench/container/zipball/04054b7c8cb30f948e5a289601c34834db58aa9f", + "reference": "04054b7c8cb30f948e5a289601c34834db58aa9f", "shasum": "" }, "require": { - "psr/container": "^1.0" + "psr/container": "^1.0", + "symfony/options-resolver": "^4.2 || ^5.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.36" + "friendsofphp/php-cs-fixer": "^2.16", + "phpstan/phpstan": "^0.12.52", + "phpunit/phpunit": "^8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1519,35 +1374,35 @@ "description": "Simple, configurable, service container.", "support": { "issues": "https://github.com/phpbench/container/issues", - "source": "https://github.com/phpbench/container/tree/1.2.1" + "source": "https://github.com/phpbench/container/tree/2.0.1" }, - "time": "2020-08-23T23:43:00+00:00" + "time": "2020-11-21T10:55:32+00:00" }, { "name": "phpbench/dom", - "version": "0.2.0", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/phpbench/dom.git", - "reference": "b135378dd0004c05ba5446aeddaf0b83339c1c4c" + "reference": "a126b32e83d0541f3c89befa1b166ba32d0048ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpbench/dom/zipball/b135378dd0004c05ba5446aeddaf0b83339c1c4c", - "reference": "b135378dd0004c05ba5446aeddaf0b83339c1c4c", + "url": "https://api.github.com/repos/phpbench/dom/zipball/a126b32e83d0541f3c89befa1b166ba32d0048ab", + "reference": "a126b32e83d0541f3c89befa1b166ba32d0048ab", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^5.4|^7.0" + "php": "^7.2|^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^8.0|^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "0.3-dev" } }, "autoload": { @@ -1568,39 +1423,39 @@ "description": "DOM wrapper to simplify working with the PHP DOM implementation", "support": { "issues": "https://github.com/phpbench/dom/issues", - "source": "https://github.com/phpbench/dom/tree/master" + "source": "https://github.com/phpbench/dom/tree/0.3.0" }, - "time": "2016-02-27T12:15:56+00:00" + "time": "2020-10-25T08:41:08+00:00" }, { "name": "phpbench/phpbench", - "version": "0.17.1", + "version": "1.0.0-alpha4", "source": { "type": "git", "url": "https://github.com/phpbench/phpbench.git", - "reference": "3211debc3afb9da79d796cf7471d52cad97b17f1" + "reference": "a0e8edfc1a308d79b4950648ece538cef7a6446e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpbench/phpbench/zipball/3211debc3afb9da79d796cf7471d52cad97b17f1", - "reference": "3211debc3afb9da79d796cf7471d52cad97b17f1", + "url": "https://api.github.com/repos/phpbench/phpbench/zipball/a0e8edfc1a308d79b4950648ece538cef7a6446e", + "reference": "a0e8edfc1a308d79b4950648ece538cef7a6446e", "shasum": "" }, "require": { "beberlei/assert": "^2.4 || ^3.0", "doctrine/annotations": "^1.2.7", + "doctrine/lexer": "^1.2", "ext-dom": "*", "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "lstrojny/functional-php": "1.0 || ^1.2.3", - "php": "^7.2", - "phpbench/container": "~1.2", - "phpbench/dom": "~0.2.0", + "ext-tokenizer": "*", + "php": "^7.2 || ^8.0", + "phpbench/container": "^2.0", + "phpbench/dom": "~0.3.0", "seld/jsonlint": "^1.1", "symfony/console": "^4.2 || ^5.0", - "symfony/debug": "^4.2 || ^5.0", "symfony/filesystem": "^4.2 || ^5.0", "symfony/finder": "^4.2 || ^5.0", "symfony/options-resolver": "^4.2 || ^5.0", @@ -1608,15 +1463,16 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "doctrine/dbal": "^2.4", + "dantleech/invoke": "^1.2", "friendsofphp/php-cs-fixer": "^2.13.1", + "jangregor/phpstan-prophecy": "^0.8.1", "padraic/phar-updater": "^1.0", - "phpspec/prophecy": "^1.8", + "phpspec/prophecy": "^1.11", "phpstan/phpstan": "^0.12.7", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^8.5.8 || ^9.0", + "symfony/var-dumper": "^4.0 || ^5.0" }, "suggest": { - "ext-curl": "For (web) reports extension", "ext-xdebug": "For Xdebug profiling extension." }, "bin": [ @@ -1631,7 +1487,6 @@ "autoload": { "psr-4": { "PhpBench\\": "lib/", - "PhpBench\\Extensions\\Dbal\\": "extensions/dbal/lib/", "PhpBench\\Extensions\\XDebug\\": "extensions/xdebug/lib/", "PhpBench\\Extensions\\Reports\\": "extensions/reports/lib/" } @@ -1649,9 +1504,9 @@ "description": "PHP Benchmarking Framework", "support": { "issues": "https://github.com/phpbench/phpbench/issues", - "source": "https://github.com/phpbench/phpbench/tree/master" + "source": "https://github.com/phpbench/phpbench/tree/1.0.0-alpha4" }, - "time": "2020-06-13T11:59:17+00:00" + "time": "2020-12-29T09:42:38+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1813,16 +1668,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.12.1", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", - "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { @@ -1834,7 +1689,7 @@ }, "require-dev": { "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0 <9.3" + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { @@ -1874,9 +1729,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.1" + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" }, - "time": "2020-09-29T09:10:42+00:00" + "time": "2020-12-19T10:15:11+00:00" }, { "name": "phpstan/extension-installer", @@ -1978,16 +1833,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.63", + "version": "0.12.64", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a" + "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c97ec4754bd53099a06c24847bd2870b99966b6a", - "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", + "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", "shasum": "" }, "require": { @@ -2018,7 +1873,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.63" + "source": "https://github.com/phpstan/phpstan/tree/0.12.64" }, "funding": [ { @@ -2034,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2020-12-15T16:37:16+00:00" + "time": "2020-12-21T11:59:02+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -3928,16 +3783,16 @@ }, { "name": "symfony/console", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b" + "reference": "47c02526c532fb381374dab26df05e7313978976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3e0564fb08d44a98bd5f1960204c958e57bd586b", - "reference": "3e0564fb08d44a98bd5f1960204c958e57bd586b", + "url": "https://api.github.com/repos/symfony/console/zipball/47c02526c532fb381374dab26df05e7313978976", + "reference": "47c02526c532fb381374dab26df05e7313978976", "shasum": "" }, "require": { @@ -4005,7 +3860,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.0" + "source": "https://github.com/symfony/console/tree/v5.2.1" }, "funding": [ { @@ -4021,76 +3876,7 @@ "type": "tidelift" } ], - "time": "2020-11-28T11:24:18+00:00" - }, - { - "name": "symfony/debug", - "version": "v4.4.17", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "65fe7b49868378319b82da3035fb30801b931c47" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/65fe7b49868378319b82da3035fb30801b931c47", - "reference": "65fe7b49868378319b82da3035fb30801b931c47", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.17" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-28T20:42:29+00:00" + "time": "2020-12-18T08:03:05+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4161,16 +3947,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "bb92ba7f38b037e531908590a858a04d85c0e238" + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb92ba7f38b037e531908590a858a04d85c0e238", - "reference": "bb92ba7f38b037e531908590a858a04d85c0e238", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fa8f8cab6b65e2d99a118e082935344c5ba8c60d", + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d", "shasum": "" }, "require": { @@ -4203,7 +3989,7 @@ "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.0" + "source": "https://github.com/symfony/filesystem/tree/v5.2.1" }, "funding": [ { @@ -4219,20 +4005,20 @@ "type": "tidelift" } ], - "time": "2020-11-12T09:58:18+00:00" + "time": "2020-11-30T17:05:38+00:00" }, { "name": "symfony/finder", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fd8305521692f27eae3263895d1ef1571c71a78d" + "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fd8305521692f27eae3263895d1ef1571c71a78d", - "reference": "fd8305521692f27eae3263895d1ef1571c71a78d", + "url": "https://api.github.com/repos/symfony/finder/zipball/0b9231a5922fd7287ba5b411893c0ecd2733e5ba", + "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba", "shasum": "" }, "require": { @@ -4264,7 +4050,7 @@ "description": "Symfony Finder Component", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.0" + "source": "https://github.com/symfony/finder/tree/v5.2.1" }, "funding": [ { @@ -4280,11 +4066,11 @@ "type": "tidelift" } ], - "time": "2020-11-18T09:42:36+00:00" + "time": "2020-12-08T17:02:38+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -4333,7 +4119,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.2.0" + "source": "https://github.com/symfony/options-resolver/tree/v5.2.1" }, "funding": [ { @@ -4839,16 +4625,16 @@ }, { "name": "symfony/process", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "240e74140d4d956265048f3025c0aecbbc302d54" + "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/240e74140d4d956265048f3025c0aecbbc302d54", - "reference": "240e74140d4d956265048f3025c0aecbbc302d54", + "url": "https://api.github.com/repos/symfony/process/zipball/bd8815b8b6705298beaa384f04fabd459c10bedd", + "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd", "shasum": "" }, "require": { @@ -4881,7 +4667,7 @@ "description": "Symfony Process Component", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.0" + "source": "https://github.com/symfony/process/tree/v5.2.1" }, "funding": [ { @@ -4897,7 +4683,7 @@ "type": "tidelift" } ], - "time": "2020-11-02T15:47:15+00:00" + "time": "2020-12-08T17:03:37+00:00" }, { "name": "symfony/service-contracts", @@ -4980,16 +4766,16 @@ }, { "name": "symfony/string", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242" + "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/40e975edadd4e32cd16f3753b3bad65d9ac48242", - "reference": "40e975edadd4e32cd16f3753b3bad65d9ac48242", + "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", "shasum": "" }, "require": { @@ -5043,7 +4829,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.0" + "source": "https://github.com/symfony/string/tree/v5.2.1" }, "funding": [ { @@ -5059,7 +4845,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:08:07+00:00" + "time": "2020-12-05T07:33:16+00:00" }, { "name": "thecodingmachine/safe", @@ -5356,7 +5142,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "phpbench/phpbench": 15 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 94ce87fe73279e6306f85942f56a29dc2febf2f2 Mon Sep 17 00:00:00 2001 From: Thomas LE BERRE <29512640+t0mmy742@users.noreply.github.com> Date: Wed, 30 Dec 2020 13:22:16 +0100 Subject: [PATCH 41/58] Update mikey179/vfsstream Bumping the minimum to ensure PHP 8.0 compatibility. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ee9b2f83..64354fb7 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "require-dev": { "infection/infection": "^0.20", "lcobucci/coding-standard": "^6.0", - "mikey179/vfsstream": "^1.6", + "mikey179/vfsstream": "^1.6.7", "phpbench/phpbench": "^1.0@alpha", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", From 096605cc20ae483e327804594e8d147e839f4adf Mon Sep 17 00:00:00 2001 From: Thomas LE BERRE <29512640+t0mmy742@users.noreply.github.com> Date: Mon, 28 Dec 2020 20:54:23 +0100 Subject: [PATCH 42/58] Improve the cache of dependencies on CI Avoiding caching the vendor directory and using the lock file to calculate the hash, according to the best practices of the action we're using. More info: https://github.com/shivammathur/setup-php#cache-composer-dependencies --- .github/workflows/benchmarks.yml | 12 +++++++----- .github/workflows/coding-standards.yml | 12 +++++++----- .github/workflows/composer-json-lint.yml | 12 +++++++----- .github/workflows/mutation-tests.yml | 12 +++++++----- .github/workflows/phpunit.yml | 24 ++++++++++++++---------- .github/workflows/static-analysis.yml | 12 +++++++----- 6 files changed, 49 insertions(+), 35 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 609f60bb..ce82a80e 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -31,14 +31,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index f25fbe95..11a72075 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -31,14 +31,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/composer-json-lint.yml b/.github/workflows/composer-json-lint.yml index 949e3918..bbcbcf9d 100644 --- a/.github/workflows/composer-json-lint.yml +++ b/.github/workflows/composer-json-lint.yml @@ -31,14 +31,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, composer-normalize, composer-require-checker, composer-unused + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 0707bb2b..d683fb7f 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -31,14 +31,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index fe8989c7..73c7c06b 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -33,14 +33,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} @@ -87,14 +89,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install locked dependencies" if: ${{ matrix.dependencies == 'locked' }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index db6068ad..7e4c9d52 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -31,14 +31,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} From c7fd031ab3ed99b399e7cc45dd3c6bc3fbea216e Mon Sep 17 00:00:00 2001 From: Thomas LE BERRE <29512640+t0mmy742@users.noreply.github.com> Date: Thu, 31 Dec 2020 12:19:49 +0100 Subject: [PATCH 43/58] Disallow failures on tests for PHP 8.0 Adding checks on PHP 8.1 as well. --- .github/workflows/benchmarks.yml | 1 + .github/workflows/phpunit.yml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index ce82a80e..a3075cdf 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -16,6 +16,7 @@ jobs: - "locked" php-version: - "7.4" + - "8.0" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 73c7c06b..908e6da1 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,6 +19,7 @@ jobs: - "development" php-version: - "7.4" + - "8.0" operating-system: - "ubuntu-latest" @@ -29,6 +30,7 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: + coverage: "none" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 tools: composer:v2, cs2pr @@ -64,7 +66,7 @@ jobs: run: "make phpunit" phpunit-rc: - name: "PHPUnit tests on PHP 8" + name: "PHPUnit tests (nightly)" runs-on: ${{ matrix.operating-system }} @@ -73,7 +75,7 @@ jobs: dependencies: - "locked" php-version: - - "8.0" + - "8.1" operating-system: - "ubuntu-latest" From fb1836a266c5d643c5c9b7deba2558b4701d0fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 5 Jan 2021 22:24:47 +0100 Subject: [PATCH 44/58] Remove memory limit from PHPStan execution --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5f8692ed..734e3d74 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ phpcs: .PHONY: phpstan phpstan: - @vendor/bin/phpstan analyse + @vendor/bin/phpstan analyse --memory-limit=-1 .PHONY: phpbench phpbench: From 33316e4f0ad0393004c88e8e0877c49cb3244901 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 23 Dec 2020 09:31:37 +0100 Subject: [PATCH 45/58] Add interface for unencrypted tokens --- docs/extending-the-library.md | 3 ++- docs/parsing-tokens.md | 4 ++-- docs/validating-tokens.md | 8 +++---- src/Token/Plain.php | 4 ++-- src/UnencryptedToken.php | 25 +++++++++++++++++++++ src/Validation/Constraint/SignedWith.php | 3 ++- src/Validation/Constraint/StrictValidAt.php | 9 ++++---- 7 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 src/UnencryptedToken.php diff --git a/docs/extending-the-library.md b/docs/extending-the-library.md index b19a6a89..89e894b7 100644 --- a/docs/extending-the-library.md +++ b/docs/extending-the-library.md @@ -172,6 +172,7 @@ To create your own implementation of constraint you must implement the `Lcobucci ```php use Lcobucci\JWT\Token; +use Lcobucci\JWT\UnencryptedToken; use Lcobucci\JWT\Validation\Constraint; use Lcobucci\JWT\Validation\ConstraintViolation; @@ -179,7 +180,7 @@ final class SubjectMustBeAValidUser implements Constraint { public function assert(Token $token): void { - if (! $token instanceof Token\Plain) { + if (! $token instanceof UnencryptedToken) { throw new ConstraintViolation('You should pass a plain token'); } diff --git a/docs/parsing-tokens.md b/docs/parsing-tokens.md index 55cafe30..0388d461 100644 --- a/docs/parsing-tokens.md +++ b/docs/parsing-tokens.md @@ -8,7 +8,7 @@ To parse a token you must create a new parser (easier when using the [configurat ```php use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\Token\Plain; +use Lcobucci\JWT\UnencryptedToken; $config = $container->get(Configuration::class); assert($config instanceof Configuration); @@ -19,7 +19,7 @@ $token = $config->parser()->parse( . '2gSBz9EOsQRN9I-3iSxJoFt7NtgV6Rm0IL6a8CAwl3Q' ); -assert($token instanceof Plain); +assert($token instanceof UnencryptedToken); $token->headers(); // Retrieves the token headers $token->claims(); // Retrieves the token claims diff --git a/docs/validating-tokens.md b/docs/validating-tokens.md index cc5cab3a..c0d9c29d 100644 --- a/docs/validating-tokens.md +++ b/docs/validating-tokens.md @@ -15,14 +15,14 @@ This method goes through every single constraint in the set, groups all the viol ```php use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\Token\Plain; +use Lcobucci\JWT\UnencryptedToken; use Lcobucci\JWT\Validation\RequiredConstraintsViolated; $config = $container->get(Configuration::class); assert($config instanceof Configuration); $token = $config->parser()->parse('...'); -assert($token instanceof Plain); +assert($token instanceof UnencryptedToken); $constraints = $config->validationConstraints(); @@ -43,13 +43,13 @@ The difference here is that we'll always get a `boolean` result and stop in the ```php use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\Token\Plain; +use Lcobucci\JWT\UnencryptedToken; $config = $container->get(Configuration::class); assert($config instanceof Configuration); $token = $config->parser()->parse('...'); -assert($token instanceof Plain); +assert($token instanceof UnencryptedToken); $constraints = $config->validationConstraints(); diff --git a/src/Token/Plain.php b/src/Token/Plain.php index 609f644f..9a292d4a 100644 --- a/src/Token/Plain.php +++ b/src/Token/Plain.php @@ -4,11 +4,11 @@ namespace Lcobucci\JWT\Token; use DateTimeInterface; -use Lcobucci\JWT\Token as TokenInterface; +use Lcobucci\JWT\UnencryptedToken; use function in_array; -final class Plain implements TokenInterface +final class Plain implements UnencryptedToken { private DataSet $headers; private DataSet $claims; diff --git a/src/UnencryptedToken.php b/src/UnencryptedToken.php new file mode 100644 index 00000000..d177059a --- /dev/null +++ b/src/UnencryptedToken.php @@ -0,0 +1,25 @@ +claims()->has(Token\RegisteredClaims::EXPIRATION_TIME)) { throw new ConstraintViolation('"Expiration Time" claim missing'); @@ -60,7 +61,7 @@ private function assertExpiration(Token\Plain $token, DateTimeInterface $now): v } /** @throws ConstraintViolation */ - private function assertMinimumTime(Token\Plain $token, DateTimeInterface $now): void + private function assertMinimumTime(UnencryptedToken $token, DateTimeInterface $now): void { if (! $token->claims()->has(Token\RegisteredClaims::NOT_BEFORE)) { throw new ConstraintViolation('"Not Before" claim missing'); @@ -72,7 +73,7 @@ private function assertMinimumTime(Token\Plain $token, DateTimeInterface $now): } /** @throws ConstraintViolation */ - private function assertIssueTime(Token\Plain $token, DateTimeInterface $now): void + private function assertIssueTime(UnencryptedToken $token, DateTimeInterface $now): void { if (! $token->claims()->has(Token\RegisteredClaims::ISSUED_AT)) { throw new ConstraintViolation('"Issued At" claim missing'); From 45a2a865254d4a0a22f60fc41221f64d1dce8fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 5 Jan 2021 22:44:40 +0100 Subject: [PATCH 46/58] Update content hash in lock file --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 184911f1..eec25ae7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1dfa158f0ebfc4a67352f7e88501d34c", + "content-hash": "8fb8ddda38bb62b0574a3c290e5f7d3e", "packages": [ { "name": "lcobucci/clock", From ab5ad23224d8e95f782cc41c699f8a3369017fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 5 Jan 2021 22:55:43 +0100 Subject: [PATCH 47/58] Ignore mutations on MultibyteStringConverter --- infection.json.dist | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/infection.json.dist b/infection.json.dist index ef8e6172..e81a4c21 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -8,7 +8,30 @@ }, "mutators": { "@default": true, - "@function_signature": true + "@function_signature": true, + "CastInt": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::octetLength", + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::readAsn1Integer" + ] + }, + "GreaterThan": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::toAsn1", + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::preparePositiveInteger", + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::retrievePositiveInteger" + ] + }, + "LessThanOrEqualTo": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::preparePositiveInteger" + ] + }, + "MBString": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter" + ] + } }, "minMsi": 93.28, "minCoveredMsi": 93.28, From 58ed092627218b6b3d1c841698031901f6d1eacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 5 Jan 2021 22:56:09 +0100 Subject: [PATCH 48/58] Ignore mutations related to PHP 7 vs PHP 8 compatibility --- infection.json.dist | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/infection.json.dist b/infection.json.dist index e81a4c21..f85801fb 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -22,6 +22,11 @@ "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::retrievePositiveInteger" ] }, + "InstanceOf_": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\OpenSSL::freeKey" + ] + }, "LessThanOrEqualTo": { "ignore": [ "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::preparePositiveInteger" @@ -31,6 +36,12 @@ "ignore": [ "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter" ] + }, + "MethodCallRemoval": { + "ignore": [ + "Lcobucci\\JWT\\Signer\\OpenSSL::createSignature", + "Lcobucci\\JWT\\Signer\\OpenSSL::verifySignature" + ] } }, "minMsi": 93.28, From fd09ca353626f02dd0c131dcaef2f011405ba418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 5 Jan 2021 22:56:33 +0100 Subject: [PATCH 49/58] Increase MSI requirements --- infection.json.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infection.json.dist b/infection.json.dist index f85801fb..0f6ca701 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -44,7 +44,7 @@ ] } }, - "minMsi": 93.28, - "minCoveredMsi": 93.28, + "minMsi": 100, + "minCoveredMsi": 100, "testFrameworkOptions": "--testsuite=unit" } From e1d3a84865acd4a9653a9c0fd44d1be3605f4cc5 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 23 Dec 2020 14:28:45 +0100 Subject: [PATCH 50/58] Add UnixTimestampDates formatter --- src/Encoding/UnixTimestampDates.php | 32 +++++++++ test/unit/Encoding/UnixTimestampDatesTest.php | 68 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/Encoding/UnixTimestampDates.php create mode 100644 test/unit/Encoding/UnixTimestampDatesTest.php diff --git a/src/Encoding/UnixTimestampDates.php b/src/Encoding/UnixTimestampDates.php new file mode 100644 index 00000000..7d58389b --- /dev/null +++ b/src/Encoding/UnixTimestampDates.php @@ -0,0 +1,32 @@ +convertDate($claims[$claim]); + } + + return $claims; + } + + private function convertDate(DateTimeImmutable $date): int + { + return $date->getTimestamp(); + } +} diff --git a/test/unit/Encoding/UnixTimestampDatesTest.php b/test/unit/Encoding/UnixTimestampDatesTest.php new file mode 100644 index 00000000..f5c4fb8a --- /dev/null +++ b/test/unit/Encoding/UnixTimestampDatesTest.php @@ -0,0 +1,68 @@ + $issuedAt, + RegisteredClaims::NOT_BEFORE => $notBefore, + RegisteredClaims::EXPIRATION_TIME => $expiration, + 'testing' => 'test', + ]; + + $formatter = new UnixTimestampDates(); + $formatted = $formatter->formatClaims($claims); + + self::assertSame(1487285080, $formatted[RegisteredClaims::ISSUED_AT]); + self::assertSame(1487285080, $formatted[RegisteredClaims::NOT_BEFORE]); + self::assertSame(1487285080, $formatted[RegisteredClaims::EXPIRATION_TIME]); + self::assertSame('test', $formatted['testing']); // this should remain untouched + } + + /** + * @test + * + * @covers ::formatClaims + * @covers ::convertDate + */ + public function notAllDateClaimsNeedToBeConfigured(): void + { + $issuedAt = new DateTimeImmutable('@1487285080'); + $expiration = DateTimeImmutable::createFromFormat('U.u', '1487285080.123456'); + + $claims = [ + RegisteredClaims::ISSUED_AT => $issuedAt, + RegisteredClaims::EXPIRATION_TIME => $expiration, + 'testing' => 'test', + ]; + + $formatter = new UnixTimestampDates(); + $formatted = $formatter->formatClaims($claims); + + self::assertSame(1487285080, $formatted[RegisteredClaims::ISSUED_AT]); + self::assertSame(1487285080, $formatted[RegisteredClaims::EXPIRATION_TIME]); + self::assertSame('test', $formatted['testing']); // this should remain untouched + } +} From 0bfd21e64b617c19fb5bcf74221fdc99e412f94a Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 23 Dec 2020 14:36:32 +0100 Subject: [PATCH 51/58] Provide a default chained formatter for UnixTimestampDates --- src/Encoding/ChainedFormatter.php | 5 +++++ test/unit/Encoding/ChainedFormatterTest.php | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Encoding/ChainedFormatter.php b/src/Encoding/ChainedFormatter.php index 8eed7e79..1670138b 100644 --- a/src/Encoding/ChainedFormatter.php +++ b/src/Encoding/ChainedFormatter.php @@ -20,6 +20,11 @@ public static function default(): self return new self(new UnifyAudience(), new MicrosecondBasedDateConversion()); } + public static function withUnixTimestampDates(): self + { + return new self(new UnifyAudience(), new UnixTimestampDates()); + } + /** @inheritdoc */ public function formatClaims(array $claims): array { diff --git a/test/unit/Encoding/ChainedFormatterTest.php b/test/unit/Encoding/ChainedFormatterTest.php index 3d2a856f..e4df60cc 100644 --- a/test/unit/Encoding/ChainedFormatterTest.php +++ b/test/unit/Encoding/ChainedFormatterTest.php @@ -15,10 +15,12 @@ final class ChainedFormatterTest extends TestCase * * @covers ::__construct * @covers ::default + * @covers ::withUnixTimestampDates * @covers ::formatClaims * * @uses \Lcobucci\JWT\Encoding\MicrosecondBasedDateConversion * @uses \Lcobucci\JWT\Encoding\UnifyAudience + * @uses \Lcobucci\JWT\Encoding\UnixTimestampDates */ public function formatClaimsShouldApplyAllConfiguredFormatters(): void { @@ -35,5 +37,11 @@ public function formatClaimsShouldApplyAllConfiguredFormatters(): void self::assertSame('test', $formatted[RegisteredClaims::AUDIENCE]); self::assertSame('1487285080.123456', $formatted[RegisteredClaims::EXPIRATION_TIME]); + + $formatter = ChainedFormatter::withUnixTimestampDates(); + $formatted = $formatter->formatClaims($claims); + + self::assertSame('test', $formatted[RegisteredClaims::AUDIENCE]); + self::assertSame(1487285080, $formatted[RegisteredClaims::EXPIRATION_TIME]); } } From b6d99464bd4d4fc0cfe84cc74b201bb15603ebe0 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 23 Dec 2020 14:36:51 +0100 Subject: [PATCH 52/58] Document a different custom formatter --- docs/extending-the-library.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/extending-the-library.md b/docs/extending-the-library.md index 89e894b7..f0018484 100644 --- a/docs/extending-the-library.md +++ b/docs/extending-the-library.md @@ -51,20 +51,17 @@ You may customise and even create your own formatters: ```php use Lcobucci\JWT\ClaimsFormatter; use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\Token\RegisteredClaims; +use Serializable; -final class UnixTimestampDates implements ClaimsFormatter +final class ClaimSerializer implements ClaimsFormatter { /** @inheritdoc */ public function formatClaims(array $claims): array { - foreach (RegisteredClaims::DATE_CLAIMS as $claim) { - if (! array_key_exists($claim, $claims)) { - continue; + foreach ($claims as $claim => $claimValue) { + if ($claimValue instanceof Serializable) { + $claims[$claim] = $claimValue->serialize(); } - - assert($claims[$claim] instanceof DateTimeImmutable); - $claims[$claim] = $claims[$claim]->getTimestamp(); } return $claims; @@ -74,7 +71,7 @@ final class UnixTimestampDates implements ClaimsFormatter $config = $container->get(Configuration::class); assert($config instanceof Configuration); -$config->builder(new UnixTimestampDates()); +$config->builder(new ClaimSerializer()); ``` The class `Lcobucci\JWT\Encoding\ChainedFormatter` allows for users to combine multiple formatters. From 2ba1e95b75b457f2fbb2e0270a84282e4ee18527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 28 Jan 2021 01:13:14 +0100 Subject: [PATCH 53/58] Add automatic release workflow --- .../workflows/release-on-milestone-closed.yml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/release-on-milestone-closed.yml diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml new file mode 100644 index 00000000..82d93d32 --- /dev/null +++ b/.github/workflows/release-on-milestone-closed.yml @@ -0,0 +1,72 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Automatic Releases" + +on: + milestone: + types: + - "closed" + +jobs: + release: + name: "GIT tag, release & create merge-up PR" + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Release" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:release" + env: + "SHELL_VERBOSITY": "3" + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create Merge-Up Pull Request" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:create-merge-up-pull-request" + env: + "SHELL_VERBOSITY": "3" + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create and/or Switch to new Release Branch" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor" + env: + "SHELL_VERBOSITY": "3" + "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Bump Changelog Version On Originating Release Branch" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:bump-changelog" + env: + "SHELL_VERBOSITY": "3" + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create new milestones" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:create-milestones" + env: + "SHELL_VERBOSITY": "3" + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} From 13b78fb04ea13001c82e730201a8d98f0baedc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 28 Jan 2021 01:33:01 +0100 Subject: [PATCH 54/58] Use a more privileged token for releases In the hope this would trigger the build on tags as well. --- .github/workflows/release-on-milestone-closed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 82d93d32..3b69e7b3 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -22,7 +22,7 @@ jobs: command-name: "laminas:automatic-releases:release" env: "SHELL_VERBOSITY": "3" - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} From bab3c0255c5445404e698daf8f3afcdd419a6b05 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 28 Jan 2021 01:54:59 +0100 Subject: [PATCH 55/58] Bump infection/infection from 0.20.2 to 0.21.0 Bumps [infection/infection](https://github.com/infection/infection) from 0.20.2 to 0.21.0. - [Release notes](https://github.com/infection/infection/releases) - [Changelog](https://github.com/infection/infection/blob/master/CHANGELOG.md) - [Commits](https://github.com/infection/infection/compare/0.20.2...0.21.0) Signed-off-by: dependabot-preview[bot] --- composer.json | 2 +- composer.lock | 389 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 235 insertions(+), 156 deletions(-) diff --git a/composer.json b/composer.json index 64354fb7..a3dea13d 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "lcobucci/clock": "^2.0" }, "require-dev": { - "infection/infection": "^0.20", + "infection/infection": "^0.21", "lcobucci/coding-standard": "^6.0", "mikey179/vfsstream": "^1.6.7", "phpbench/phpbench": "^1.0@alpha", diff --git a/composer.lock b/composer.lock index eec25ae7..685c5045 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8fb8ddda38bb62b0574a3c290e5f7d3e", + "content-hash": "606dc98202ec466dc147e1b3f58dfafc", "packages": [ { "name": "lcobucci/clock", @@ -134,6 +134,79 @@ }, "time": "2020-11-13T20:02:54+00:00" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.1", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-11-11T10:22:58+00:00" + }, { "name": "composer/xdebug-handler", "version": "1.4.5", @@ -695,16 +768,16 @@ }, { "name": "infection/infection", - "version": "0.20.2", + "version": "0.21.0", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "6035c1566af6a5a8d833a276351e5e18ed412305" + "reference": "dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/6035c1566af6a5a8d833a276351e5e18ed412305", - "reference": "6035c1566af6a5a8d833a276351e5e18ed412305", + "url": "https://api.github.com/repos/infection/infection/zipball/dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82", + "reference": "dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82", "shasum": "" }, "require": { @@ -716,11 +789,12 @@ "infection/extension-installer": "^0.1.0", "infection/include-interceptor": "^0.2.4", "justinrainbow/json-schema": "^5.2", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.10.3", "ocramius/package-versions": "^1.2 || ^2.0", "ondram/ci-detector": "^3.3.0", "php": "^7.4 || ^8.0", - "sanmai/pipeline": "^3.1 || ^5.0", + "sanmai/later": "^0.1.1", + "sanmai/pipeline": "^5.1", "sebastian/diff": "^3.0.2 || ^4.0", "seld/jsonlint": "^1.7", "symfony/console": "^3.4.29 || ^4.1.19 || ^5.0", @@ -745,10 +819,9 @@ "phpstan/phpstan-strict-rules": "^0.12.5", "phpstan/phpstan-webmozart-assert": "^0.12.2", "phpunit/phpunit": "^9.3.11", - "symfony/phpunit-bridge": "^4.4.14 || ^5.1.6", + "symfony/phpunit-bridge": "^4.4.18 || ^5.1.10", "symfony/yaml": "^5.0", - "thecodingmachine/phpstan-safe-rule": "^1.0", - "vimeo/psalm": "^4.0" + "thecodingmachine/phpstan-safe-rule": "^1.0" }, "bin": [ "bin/infection" @@ -804,9 +877,19 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.20.2" + "source": "https://github.com/infection/infection/tree/0.21.0" }, - "time": "2020-11-20T17:15:57+00:00" + "funding": [ + { + "url": "https://github.com/infection", + "type": "github" + }, + { + "url": "https://opencollective.com/infection", + "type": "open_collective" + } + ], + "time": "2021-01-26T22:10:01+00:00" }, { "name": "justinrainbow/json-schema", @@ -1082,68 +1165,6 @@ }, "time": "2020-12-20T10:01:03+00:00" }, - { - "name": "ocramius/package-versions", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a7e35c34bc166a5684a1e2f13da7b1d6a821349d", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.4.7 || ~8.0.0" - }, - "replace": { - "composer/package-versions-deprecated": "*" - }, - "require-dev": { - "composer/composer": "^2.0.0@dev", - "doctrine/coding-standard": "^8.1.0", - "ext-zip": "^1.15.0", - "infection/infection": "dev-master#8d6c4d6b15ec58d3190a78b7774a5d604ec1075a", - "phpunit/phpunit": "~9.3.11", - "vimeo/psalm": "^4.0.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/Ocramius/PackageVersions/issues", - "source": "https://github.com/Ocramius/PackageVersions/tree/2.1.0" - }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ocramius/package-versions", - "type": "tidelift" - } - ], - "time": "2020-10-21T13:48:04+00:00" - }, { "name": "ondram/ci-detector", "version": "3.5.1", @@ -2572,6 +2593,64 @@ }, "time": "2020-03-23T09:12:05+00:00" }, + { + "name": "sanmai/later", + "version": "0.1.2", + "source": { + "type": "git", + "url": "https://github.com/sanmai/later.git", + "reference": "9b659fecef2030193fd02402955bc39629d5606f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sanmai/later/zipball/9b659fecef2030193fd02402955bc39629d5606f", + "reference": "9b659fecef2030193fd02402955bc39629d5606f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.13", + "infection/infection": ">=0.10.5", + "phan/phan": ">=2", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": ">=0.10", + "phpunit/phpunit": ">=7.4", + "vimeo/psalm": ">=2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Later\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alexey Kopytko", + "email": "alexey@kopytko.com" + } + ], + "description": "Later: deferred wrapper object", + "support": { + "issues": "https://github.com/sanmai/later/issues", + "source": "https://github.com/sanmai/later/tree/0.1.2" + }, + "funding": [ + { + "url": "https://github.com/sanmai", + "type": "github" + } + ], + "time": "2021-01-02T10:26:44+00:00" + }, { "name": "sanmai/pipeline", "version": "v5.1.0", @@ -3783,16 +3862,16 @@ }, { "name": "symfony/console", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "47c02526c532fb381374dab26df05e7313978976" + "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/47c02526c532fb381374dab26df05e7313978976", - "reference": "47c02526c532fb381374dab26df05e7313978976", + "url": "https://api.github.com/repos/symfony/console/zipball/d62ec79478b55036f65e2602e282822b8eaaff0a", + "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a", "shasum": "" }, "require": { @@ -3851,7 +3930,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "keywords": [ "cli", @@ -3860,7 +3939,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.1" + "source": "https://github.com/symfony/console/tree/v5.2.2" }, "funding": [ { @@ -3876,7 +3955,7 @@ "type": "tidelift" } ], - "time": "2020-12-18T08:03:05+00:00" + "time": "2021-01-27T10:15:41+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3947,16 +4026,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d" + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/fa8f8cab6b65e2d99a118e082935344c5ba8c60d", - "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/262d033b57c73e8b59cd6e68a45c528318b15038", + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038", "shasum": "" }, "require": { @@ -3986,10 +4065,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.1" + "source": "https://github.com/symfony/filesystem/tree/v5.2.2" }, "funding": [ { @@ -4005,20 +4084,20 @@ "type": "tidelift" } ], - "time": "2020-11-30T17:05:38+00:00" + "time": "2021-01-27T10:01:46+00:00" }, { "name": "symfony/finder", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba" + "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0b9231a5922fd7287ba5b411893c0ecd2733e5ba", - "reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba", + "url": "https://api.github.com/repos/symfony/finder/zipball/196f45723b5e618bf0e23b97e96d11652696ea9e", + "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e", "shasum": "" }, "require": { @@ -4047,10 +4126,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.1" + "source": "https://github.com/symfony/finder/tree/v5.2.2" }, "funding": [ { @@ -4066,7 +4145,7 @@ "type": "tidelift" } ], - "time": "2020-12-08T17:02:38+00:00" + "time": "2021-01-27T10:01:46+00:00" }, { "name": "symfony/options-resolver", @@ -4139,16 +4218,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -4160,7 +4239,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4198,7 +4277,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" }, "funding": [ { @@ -4214,20 +4293,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c" + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { @@ -4239,7 +4318,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4279,7 +4358,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" }, "funding": [ { @@ -4295,20 +4374,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "727d1096295d807c309fb01a851577302394c897" + "reference": "6e971c891537eb617a00bb07a43d182a6915faba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", - "reference": "727d1096295d807c309fb01a851577302394c897", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", + "reference": "6e971c891537eb617a00bb07a43d182a6915faba", "shasum": "" }, "require": { @@ -4320,7 +4399,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4363,7 +4442,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" }, "funding": [ { @@ -4379,20 +4458,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T17:09:11+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", "shasum": "" }, "require": { @@ -4404,7 +4483,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4443,7 +4522,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" }, "funding": [ { @@ -4459,20 +4538,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed" + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/8ff431c517be11c78c48a39a66d37431e26a6bed", - "reference": "8ff431c517be11c78c48a39a66d37431e26a6bed", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { @@ -4481,7 +4560,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4522,7 +4601,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" }, "funding": [ { @@ -4538,20 +4617,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de" + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { @@ -4560,7 +4639,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4605,7 +4684,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" }, "funding": [ { @@ -4621,20 +4700,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/process", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd" + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/bd8815b8b6705298beaa384f04fabd459c10bedd", - "reference": "bd8815b8b6705298beaa384f04fabd459c10bedd", + "url": "https://api.github.com/repos/symfony/process/zipball/313a38f09c77fbcdc1d223e57d368cea76a2fd2f", + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f", "shasum": "" }, "require": { @@ -4664,10 +4743,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.1" + "source": "https://github.com/symfony/process/tree/v5.2.2" }, "funding": [ { @@ -4683,7 +4762,7 @@ "type": "tidelift" } ], - "time": "2020-12-08T17:03:37+00:00" + "time": "2021-01-27T10:15:41+00:00" }, { "name": "symfony/service-contracts", @@ -4766,16 +4845,16 @@ }, { "name": "symfony/string", - "version": "v5.2.1", + "version": "v5.2.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed" + "reference": "c95468897f408dd0aca2ff582074423dd0455122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", - "reference": "5bd67751d2e3f7d6f770c9154b8fbcb2aa05f7ed", + "url": "https://api.github.com/repos/symfony/string/zipball/c95468897f408dd0aca2ff582074423dd0455122", + "reference": "c95468897f408dd0aca2ff582074423dd0455122", "shasum": "" }, "require": { @@ -4818,7 +4897,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony String component", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ "grapheme", @@ -4829,7 +4908,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.1" + "source": "https://github.com/symfony/string/tree/v5.2.2" }, "funding": [ { @@ -4845,7 +4924,7 @@ "type": "tidelift" } ], - "time": "2020-12-05T07:33:16+00:00" + "time": "2021-01-25T15:14:59+00:00" }, { "name": "thecodingmachine/safe", @@ -5041,12 +5120,12 @@ "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, @@ -5084,8 +5163,8 @@ "validate" ], "support": { - "issues": "https://github.com/webmozart/assert/issues", - "source": "https://github.com/webmozart/assert/tree/master" + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, "time": "2020-07-08T17:02:28+00:00" }, From db669595067a79db5d9ce6da2d7d6e06da0a27fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 28 Jan 2021 01:49:14 +0100 Subject: [PATCH 56/58] Kill mutations --- test/unit/Signer/RsaTest.php | 4 ++-- test/unit/Token/BuilderTest.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/unit/Signer/RsaTest.php b/test/unit/Signer/RsaTest.php index 9909b11c..b966cc7d 100644 --- a/test/unit/Signer/RsaTest.php +++ b/test/unit/Signer/RsaTest.php @@ -67,7 +67,7 @@ public function signShouldRaiseAnExceptionWhenKeyIsInvalid(): void $signer = $this->getSigner(); $this->expectException(CannotSignPayload::class); - $this->expectExceptionMessage('There was an error while creating the signature'); + $this->expectExceptionMessage('There was an error while creating the signature: error:'); $signer->sign('testing', InMemory::plainText($key)); } @@ -86,7 +86,7 @@ public function signShouldRaiseAnExceptionWhenKeyIsNotParseable(): void $signer = $this->getSigner(); $this->expectException(InvalidKeyProvided::class); - $this->expectExceptionMessage('It was not possible to parse your key'); + $this->expectExceptionMessage('It was not possible to parse your key, reason: error:'); $signer->sign('testing', InMemory::plainText('blablabla')); } diff --git a/test/unit/Token/BuilderTest.php b/test/unit/Token/BuilderTest.php index 31ba8b9f..2fbeedc3 100644 --- a/test/unit/Token/BuilderTest.php +++ b/test/unit/Token/BuilderTest.php @@ -89,7 +89,12 @@ public function getTokenShouldReturnACompletelyConfigureToken(): void $this->encoder->expects(self::exactly(3)) ->method('base64UrlEncode') - ->willReturnOnConsecutiveCalls('1', '2', '3'); + ->willReturnArgument(0); + + $this->signer->expects(self::once()) + ->method('sign') + ->with('1.2') + ->willReturn('3'); $builder = new Builder($this->encoder, new MicrosecondBasedDateConversion()); $token = $builder->identifiedBy('123456') From 3a72bba6e6588450cb8bd507b4c4b2d257f87931 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 12 Feb 2021 15:35:17 +0100 Subject: [PATCH 57/58] Provide Sodium base64 polyfill for libsodium < 1.0.14 --- infection.json.dist | 5 + src/Encoding/CannotDecodeContent.php | 5 +- src/Encoding/JoseEncoder.php | 19 ++- src/Signer/Key/InMemory.php | 15 +- src/SodiumBase64Polyfill.php | 88 +++++++++++ test/functional/ES512TokenTest.php | 1 + test/functional/EcdsaTokenTest.php | 1 + test/functional/EddsaTokenTest.php | 1 + test/functional/HmacTokenTest.php | 1 + .../MaliciousTamperingPreventionTest.php | 1 + test/functional/RsaTokenTest.php | 1 + test/functional/UnsignedTokenTest.php | 1 + test/unit/Encoding/JoseEncoderTest.php | 10 ++ test/unit/Signer/EddsaTest.php | 3 + test/unit/Signer/Key/InMemoryTest.php | 4 + test/unit/SodiumBase64PolyfillTest.php | 139 ++++++++++++++++++ 16 files changed, 272 insertions(+), 23 deletions(-) create mode 100644 src/SodiumBase64Polyfill.php create mode 100644 test/unit/SodiumBase64PolyfillTest.php diff --git a/infection.json.dist b/infection.json.dist index 0f6ca701..318f231c 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -32,6 +32,11 @@ "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter::preparePositiveInteger" ] }, + "LogicalNot": { + "ignoreSourceCodeByRegex": [ + "if \\(!function_exists\\('sodium_\\w+'\\)\\) \\{" + ] + }, "MBString": { "ignore": [ "Lcobucci\\JWT\\Signer\\Ecdsa\\MultibyteStringConverter" diff --git a/src/Encoding/CannotDecodeContent.php b/src/Encoding/CannotDecodeContent.php index 33607b11..8363061a 100644 --- a/src/Encoding/CannotDecodeContent.php +++ b/src/Encoding/CannotDecodeContent.php @@ -6,7 +6,6 @@ use JsonException; use Lcobucci\JWT\Exception; use RuntimeException; -use SodiumException; final class CannotDecodeContent extends RuntimeException implements Exception { @@ -15,8 +14,8 @@ public static function jsonIssues(JsonException $previous): self return new self('Error while decoding from JSON', 0, $previous); } - public static function invalidBase64String(SodiumException $sodiumException): self + public static function invalidBase64String(): self { - return new self('Error while decoding from Base64Url, invalid base64 characters detected', 0, $sodiumException); + return new self('Error while decoding from Base64Url, invalid base64 characters detected'); } } diff --git a/src/Encoding/JoseEncoder.php b/src/Encoding/JoseEncoder.php index 4d8fc241..597d15f9 100644 --- a/src/Encoding/JoseEncoder.php +++ b/src/Encoding/JoseEncoder.php @@ -6,17 +6,14 @@ use JsonException; use Lcobucci\JWT\Decoder; use Lcobucci\JWT\Encoder; -use SodiumException; +use Lcobucci\JWT\SodiumBase64Polyfill; use function json_decode; use function json_encode; -use function sodium_base642bin; -use function sodium_bin2base64; use const JSON_THROW_ON_ERROR; use const JSON_UNESCAPED_SLASHES; use const JSON_UNESCAPED_UNICODE; -use const SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING; /** * A utilitarian class that encodes and decodes data according with JOSE specifications @@ -47,15 +44,17 @@ public function jsonDecode(string $json) public function base64UrlEncode(string $data): string { - return sodium_bin2base64($data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING); + return SodiumBase64Polyfill::bin2base64( + $data, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING + ); } public function base64UrlDecode(string $data): string { - try { - return sodium_base642bin($data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, ''); - } catch (SodiumException $sodiumException) { - throw CannotDecodeContent::invalidBase64String($sodiumException); - } + return SodiumBase64Polyfill::base642bin( + $data, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING + ); } } diff --git a/src/Signer/Key/InMemory.php b/src/Signer/Key/InMemory.php index 2b62edae..1a4df0f5 100644 --- a/src/Signer/Key/InMemory.php +++ b/src/Signer/Key/InMemory.php @@ -3,17 +3,13 @@ namespace Lcobucci\JWT\Signer\Key; -use Lcobucci\JWT\Encoding\CannotDecodeContent; use Lcobucci\JWT\Signer\Key; -use SodiumException; +use Lcobucci\JWT\SodiumBase64Polyfill; use SplFileObject; use Throwable; use function assert; use function is_string; -use function sodium_base642bin; - -use const SODIUM_BASE64_VARIANT_ORIGINAL; final class InMemory implements Key { @@ -38,11 +34,10 @@ public static function plainText(string $contents, string $passphrase = ''): sel public static function base64Encoded(string $contents, string $passphrase = ''): self { - try { - $decoded = sodium_base642bin($contents, SODIUM_BASE64_VARIANT_ORIGINAL, ''); - } catch (SodiumException $sodiumException) { - throw CannotDecodeContent::invalidBase64String($sodiumException); - } + $decoded = SodiumBase64Polyfill::base642bin( + $contents, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_ORIGINAL + ); return new self($decoded, $passphrase); } diff --git a/src/SodiumBase64Polyfill.php b/src/SodiumBase64Polyfill.php new file mode 100644 index 00000000..6a9c7ce5 --- /dev/null +++ b/src/SodiumBase64Polyfill.php @@ -0,0 +1,88 @@ +testString = sodium_base642bin('I+o2tVq8ynY=', SODIUM_BASE64_VARIANT_ORIGINAL, ''); + } + + /** + * @test + * + * @coversNothing + */ + public function constantsMatchExtensionOnes(): void + { + self::assertSame( + SODIUM_BASE64_VARIANT_ORIGINAL, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_ORIGINAL + ); + self::assertSame( + SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING + ); + self::assertSame( + SODIUM_BASE64_VARIANT_URLSAFE, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_URLSAFE + ); + self::assertSame( + SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, + SodiumBase64Polyfill::SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING + ); + } + + /** + * @test + * @dataProvider provideVariants + * + * @covers ::bin2base64 + * @covers ::bin2base64Fallback + */ + public function bin2base64(int $variant): void + { + $expected = sodium_bin2base64($this->testString, $variant); + + self::assertSame( + $expected, + SodiumBase64Polyfill::bin2base64($this->testString, $variant) + ); + + self::assertSame( + $expected, + SodiumBase64Polyfill::bin2base64Fallback($this->testString, $variant) + ); + } + + /** + * @test + * @dataProvider provideVariants + * + * @covers ::base642bin + * @covers ::base642binFallback + */ + public function base642binFallback(int $variant): void + { + self::assertSame( + $this->testString, + SodiumBase64Polyfill::base642bin( + sodium_bin2base64($this->testString, $variant), + $variant + ) + ); + + self::assertSame( + $this->testString, + SodiumBase64Polyfill::base642binFallback( + sodium_bin2base64($this->testString, $variant), + $variant + ) + ); + } + + /** @return int[][] */ + public function provideVariants(): array + { + return [ + [SODIUM_BASE64_VARIANT_ORIGINAL], + [SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING], + [SODIUM_BASE64_VARIANT_URLSAFE], + [SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING], + ]; + } + + /** + * @test + * + * @covers ::base642bin + * + * @uses \Lcobucci\JWT\Encoding\CannotDecodeContent::invalidBase64String() + */ + public function sodiumBase642BinRaisesExceptionOnInvalidBase64(): void + { + $this->expectException(CannotDecodeContent::class); + + SodiumBase64Polyfill::base642bin('ááá', SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING); + } + + /** + * @test + * + * @covers ::base642binFallback + * + * @uses \Lcobucci\JWT\Encoding\CannotDecodeContent::invalidBase64String() + */ + public function fallbackBase642BinRaisesExceptionOnInvalidBase64(): void + { + $this->expectException(CannotDecodeContent::class); + + SodiumBase64Polyfill::base642binFallback('ááá', SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING); + } +} From 6c37412d2b58edf4ca79710d32e65478a578c99c Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 19 Feb 2021 12:52:58 +0100 Subject: [PATCH 58/58] SodiumBase64Polyfill: fix fallback method reference --- src/SodiumBase64Polyfill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SodiumBase64Polyfill.php b/src/SodiumBase64Polyfill.php index 6a9c7ce5..a00068db 100644 --- a/src/SodiumBase64Polyfill.php +++ b/src/SodiumBase64Polyfill.php @@ -57,7 +57,7 @@ public static function bin2base64Fallback(string $decoded, int $variant): string public static function base642bin(string $encoded, int $variant): string { if (! function_exists('sodium_base642bin')) { - return self::bin2base64Fallback($encoded, $variant); // @codeCoverageIgnore + return self::base642binFallback($encoded, $variant); // @codeCoverageIgnore } try {