From 80285bda96b667e6301e9905d74baa2257687394 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 19 Apr 2022 13:47:22 +0200 Subject: [PATCH 1/5] Fix compatibility with lcobucci/jwt ^4.2 --- src/Entities/Traits/AccessTokenTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entities/Traits/AccessTokenTrait.php b/src/Entities/Traits/AccessTokenTrait.php index 5caf9533d..81b634397 100644 --- a/src/Entities/Traits/AccessTokenTrait.php +++ b/src/Entities/Traits/AccessTokenTrait.php @@ -46,7 +46,7 @@ public function initJwtConfiguration() $this->jwtConfiguration = Configuration::forAsymmetricSigner( new Sha256(), InMemory::plainText($this->privateKey->getKeyContents(), $this->privateKey->getPassPhrase() ?? ''), - InMemory::plainText('') + InMemory::plainText('empty', 'empty') ); } From b35b3d7cb90965131c0bc3b67030655368cbcaba Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Tue, 3 May 2022 22:07:14 +0100 Subject: [PATCH 2/5] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c330d08c..2c8e22318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Use InMemory::empty() instead of InMemory::plainText('') to avoid new empty string exception thrown by lcobucci/jwt (PR #1282) ## [8.3.4] - released 2022-04-07 ### Fixed From c3e4990f84726aded93f4c151b7556b8e0d41bed Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Tue, 3 May 2022 22:09:36 +0100 Subject: [PATCH 3/5] Change to use empty() function instead of 'empty' as a string --- src/AuthorizationValidators/BearerTokenValidator.php | 2 +- src/Entities/Traits/AccessTokenTrait.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AuthorizationValidators/BearerTokenValidator.php b/src/AuthorizationValidators/BearerTokenValidator.php index e41e1a2b7..93ab8ff8b 100644 --- a/src/AuthorizationValidators/BearerTokenValidator.php +++ b/src/AuthorizationValidators/BearerTokenValidator.php @@ -70,7 +70,7 @@ private function initJwtConfiguration() { $this->jwtConfiguration = Configuration::forSymmetricSigner( new Sha256(), - InMemory::plainText('') + InMemory::empty() ); $this->jwtConfiguration->setValidationConstraints( diff --git a/src/Entities/Traits/AccessTokenTrait.php b/src/Entities/Traits/AccessTokenTrait.php index 81b634397..9e2dedc7f 100644 --- a/src/Entities/Traits/AccessTokenTrait.php +++ b/src/Entities/Traits/AccessTokenTrait.php @@ -46,7 +46,7 @@ public function initJwtConfiguration() $this->jwtConfiguration = Configuration::forAsymmetricSigner( new Sha256(), InMemory::plainText($this->privateKey->getKeyContents(), $this->privateKey->getPassPhrase() ?? ''), - InMemory::plainText('empty', 'empty') + InMemory::empty() ); } From 6b4c480decabd030ca990aa355be88bc0ad1d029 Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Tue, 3 May 2022 22:15:40 +0100 Subject: [PATCH 4/5] revert usage of empty() as not present in supported versions of lib --- CHANGELOG.md | 2 +- src/AuthorizationValidators/BearerTokenValidator.php | 2 +- src/Entities/Traits/AccessTokenTrait.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8e22318..e7c382427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Fixed -- Use InMemory::empty() instead of InMemory::plainText('') to avoid new empty string exception thrown by lcobucci/jwt (PR #1282) +- Use string 'empty' instead of InMemory::plainText('') to avoid new empty string exception thrown by lcobucci/jwt (PR #1282) ## [8.3.4] - released 2022-04-07 ### Fixed diff --git a/src/AuthorizationValidators/BearerTokenValidator.php b/src/AuthorizationValidators/BearerTokenValidator.php index 93ab8ff8b..3c16f6850 100644 --- a/src/AuthorizationValidators/BearerTokenValidator.php +++ b/src/AuthorizationValidators/BearerTokenValidator.php @@ -70,7 +70,7 @@ private function initJwtConfiguration() { $this->jwtConfiguration = Configuration::forSymmetricSigner( new Sha256(), - InMemory::empty() + InMemory::plainText('empty', 'empty') ); $this->jwtConfiguration->setValidationConstraints( diff --git a/src/Entities/Traits/AccessTokenTrait.php b/src/Entities/Traits/AccessTokenTrait.php index 9e2dedc7f..81b634397 100644 --- a/src/Entities/Traits/AccessTokenTrait.php +++ b/src/Entities/Traits/AccessTokenTrait.php @@ -46,7 +46,7 @@ public function initJwtConfiguration() $this->jwtConfiguration = Configuration::forAsymmetricSigner( new Sha256(), InMemory::plainText($this->privateKey->getKeyContents(), $this->privateKey->getPassPhrase() ?? ''), - InMemory::empty() + InMemory::plainText('empty', 'empty') ); } From 88c4e2835343d5a460e273eeefbcf007d3d7629d Mon Sep 17 00:00:00 2001 From: Andrew Millington Date: Tue, 3 May 2022 22:20:11 +0100 Subject: [PATCH 5/5] Add reference to new exception thrown to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c382427..b83689127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Fixed -- Use string 'empty' instead of InMemory::plainText('') to avoid new empty string exception thrown by lcobucci/jwt (PR #1282) +- Use InMemory::plainText('empty', 'empty') instead of InMemory::plainText('') to avoid [new empty string exception](https://github.com/lcobucci/jwt/pull/833) thrown by lcobucci/jwt (PR #1282) ## [8.3.4] - released 2022-04-07 ### Fixed