Skip to content

Commit

Permalink
Fix exception for NullSite in backend context
Browse files Browse the repository at this point in the history
  • Loading branch information
r3h6i committed Jul 24, 2024
1 parent 3561ab3 commit e596bcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Classes/Middleware/Oauth2Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use R3H6\Oauth2Server\ExceptionHandlingTrait;
use R3H6\Oauth2Server\Http\RequestAttribute;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/***
Expand All @@ -33,7 +34,11 @@ class Oauth2Configuration implements MiddlewareInterface

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$siteConfiguration = $request->getAttribute('site')->getConfiguration()['oauth2'] ?? false;
$site = $request->getAttribute('site');
if (!$site instanceof Site) {
return $handler->handle($request);
}
$siteConfiguration = $site->getConfiguration()['oauth2'] ?? false;
if ($siteConfiguration === false || !($siteConfiguration['enabled'] ?? true)) {
return $handler->handle($request);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"ci:php:stan": "phpstan --no-progress",
"ci:test:unit": "phpunit -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/",
"ci:libs:pack": "phar-composer build softcreatr/jsonpath Resources/Private/Php/jsonpath.phar",
"fix:php:cs": "php-cs-fixer fix --config .php-cs-fixer.php"
"fix:php:cs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config .php-cs-fixer.php"
},
"extra": {
"typo3/cms": {
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'state' => 'beta',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '1.5.3',
'version' => '1.5.4',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-11.5.99',
Expand Down

0 comments on commit e596bcd

Please sign in to comment.