Skip to content

Commit

Permalink
Merge branch 'master' into release-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
balasch committed Jun 30, 2023
2 parents 8e0e340 + f23876c commit db25b11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Classes/Middleware/TokenRefreshMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
***/

use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use Leuchtfeuer\SecureDownloads\Domain\Transfer\ExtensionConfiguration;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -86,10 +87,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
if (preg_match_all($pattern, $content, $foundJwtTokens)) {
foreach ($foundJwtTokens[1] as $foundJwtToken) {
try {
$data = JWT::decode($foundJwtToken, $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], ['HS256']);
$data = JWT::decode($foundJwtToken, new Key($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'HS256'));
if ((int)$data->user !== $currentUserId) {
$data->user = $currentUserId;
$newToken = JWT::encode($data, $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'HS256');
$newToken = JWT::encode((array)$data, $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'HS256');
$replaces[$foundJwtToken] = $newToken;
}
} catch (\Exception $exception) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Middleware/TokenRefreshMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function invokeMethod(&$object, $methodName, array $parameters = [])
return $method->invokeArgs($object, $parameters);
}

public function setPrivateProperty(string $className, object $object, string $property, mixed $value)
public function setPrivateProperty(string $className, object $object, string $property, $value)
{
$reflectionProperty = new \ReflectionProperty($className, $property);
$reflectionProperty->setAccessible(true);
Expand Down

0 comments on commit db25b11

Please sign in to comment.