From 266ac146a37f450b6faef3febe35e1f614aa5be6 Mon Sep 17 00:00:00 2001 From: abid Date: Wed, 6 Sep 2023 13:06:44 +0200 Subject: [PATCH 01/16] [TASK]Make required libraries compatible for TYPO3 12; Require rector for dev environement --- composer.json | 31 +++++++++++++++++++------------ ext_emconf.php | 4 ++-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 09a4e592..e2a6f07e 100644 --- a/composer.json +++ b/composer.json @@ -22,22 +22,28 @@ "email": "m.roesch@Leuchtfeuer.com", "homepage": "https://www.Leuchtfeuer.com", "role": "Developer" + }, + { + "name": "Yassine Abid", + "email": "y.abid@Leuchtfeuer.com", + "homepage": "https://www.Leuchtfeuer.com", + "role": "Developer" } ], "homepage": "https://www.Leuchtfeuer.com", "require": { "auth0/auth0-php": "^8.1", "lcobucci/jwt": "^4.1", - "symfony/http-foundation": "^5.4", - "symfony/property-access": "^4.4 || ^5.4", - "symfony/property-info": "^5.0", - "symfony/serializer": "^4.4 || ^5.4", - "typo3/cms-backend": "^10.4.25 || ^11.5.7", - "typo3/cms-core": "^10.4.25 || ^11.5.7", - "typo3/cms-extbase": "^10.4.25 || ^11.5.7", - "typo3/cms-extensionmanager": "^10.4.25 || ^11.5.7", - "typo3/cms-fluid": "^10.4.25 || ^11.5.7", - "typo3/cms-frontend": "^10.4.25 || ^11.5.7" + "symfony/http-foundation": "^5.4 || ^6.2", + "symfony/property-access": "^4.4 || ^5.4 || ^6.2", + "symfony/property-info": "^5.4 || ^6.3", + "symfony/serializer": "^4.4 || ^5.4 || ^6.2", + "typo3/cms-backend": "^11.5.7 || ^12.4", + "typo3/cms-core": "^11.5.7 || ^12.4", + "typo3/cms-extbase": "^11.5.7 || ^12.4", + "typo3/cms-extensionmanager": "^11.5.7 || ^12.4", + "typo3/cms-fluid": "^11.5.7 || ^12.4", + "typo3/cms-frontend": "^11.5.7 || ^12.4" }, "replace": { "bitmotion/auth0": "self.version", @@ -48,7 +54,7 @@ }, "autoload": { "psr-4": { - "Bitmotion\\Auth0\\": "Classes/" + "Leuchtfeuer\\Auth0\\": "Classes/" } }, "config": { @@ -77,6 +83,7 @@ ] }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14" + "ssch/typo3-rector": "^1.3", + "friendsofphp/php-cs-fixer": "^3.25" } } diff --git a/ext_emconf.php b/ext_emconf.php index ccc851d2..540517e7 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -3,11 +3,11 @@ $EM_CONF['auth0'] = [ 'title' => 'Auth0 for TYPO3', 'description' => 'This extension allows you to log into a TYPO3 backend or frontend via Auth0. Auth0 is the solution you need for web, mobile, IoT, and internal applications. Loved by developers and trusted by enterprises.', - 'version' => '4.0.0-dev', + 'version' => '5.0.0', 'category' => 'misc', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-11.5.99', + 'typo3' => '11.5.99-12.4.99', ], 'conflicts' => [], 'suggests' => [], From fdb1685b1b91615b020680061bc7e0e0b46c3df3 Mon Sep 17 00:00:00 2001 From: abid Date: Wed, 6 Sep 2023 13:26:12 +0200 Subject: [PATCH 02/16] [TASK]Process ext with rector for typo3 v11 and php74 --- Classes/Controller/ApplicationController.php | 4 ++- Classes/Controller/BackendController.php | 36 +++++++++++--------- Classes/Controller/LoginController.php | 4 ++- Classes/Controller/PropertyController.php | 15 +++++--- Classes/Controller/RoleController.php | 3 +- Classes/Middleware/CallbackMiddleware.php | 6 ++-- Classes/Service/RedirectService.php | 11 +++--- Classes/Utility/TokenUtility.php | 5 +-- Configuration/RequestMiddlewares.php | 4 ++- Configuration/TCA/Overrides/be_groups.php | 16 +++++---- Configuration/TCA/Overrides/be_users.php | 4 ++- Configuration/TCA/Overrides/fe_groups.php | 16 +++++---- Configuration/TCA/Overrides/fe_users.php | 4 ++- Configuration/TCA/Overrides/sys_template.php | 4 ++- Configuration/TCA/Overrides/tt_content.php | 10 ++++-- ext_emconf.php | 1 - ext_localconf.php | 2 +- 17 files changed, 89 insertions(+), 56 deletions(-) diff --git a/Classes/Controller/ApplicationController.php b/Classes/Controller/ApplicationController.php index 8747c0d6..eefa84fb 100644 --- a/Classes/Controller/ApplicationController.php +++ b/Classes/Controller/ApplicationController.php @@ -11,6 +11,7 @@ namespace Bitmotion\Auth0\Controller; +use Psr\Http\Message\ResponseInterface; use Bitmotion\Auth0\Domain\Model\Application; use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; @@ -23,7 +24,7 @@ class ApplicationController extends BackendController /** * @throws RouteNotFoundException */ - public function listAction(): void + public function listAction(): ResponseInterface { $pid = $this->getStoragePage(); $this->view->assignMultiple([ @@ -32,6 +33,7 @@ public function listAction(): void 'directory' => BackendUtility::getRecord('pages', $pid), 'returnUrl' => $this->getModuleUrl(false), ]); + return $this->htmlResponse(); } /** diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 9b245359..db25f72e 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -11,6 +11,8 @@ namespace Bitmotion\Auth0\Controller; +use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; +use Psr\Http\Message\ResponseInterface; use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder; @@ -24,31 +26,30 @@ class BackendController extends ActionController { - /** - * @var BackendTemplateView - */ - protected $view; - - protected $defaultViewObjectName = BackendTemplateView::class; - protected ApplicationRepository $applicationRepository; + private ModuleTemplateFactory $moduleTemplateFactory; - public function __construct(ApplicationRepository $applicationRepository) + public function __construct(ApplicationRepository $applicationRepository, ModuleTemplateFactory $moduleTemplateFactory) { $this->applicationRepository = $applicationRepository; + $this->moduleTemplateFactory = $moduleTemplateFactory; } - public function listAction(): void + public function listAction(): ResponseInterface { + $moduleTemplate = $this->moduleTemplateFactory->create($this->request); // Just an empty view + $moduleTemplate->setContent($this->view->render()); + return $this->htmlResponse($moduleTemplate->renderContent()); } public function initializeView(ViewInterface $view): void { + $moduleTemplate = $this->moduleTemplateFactory->create($this->request); parent::initializeView($view); if ($this->request->getControllerName() !== 'Backend' && $view instanceof BackendTemplateView) { - $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); + $moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); $this->createMenu(); $this->createButtonBar(); } @@ -56,7 +57,8 @@ public function initializeView(ViewInterface $view): void protected function createMenu(): void { - $menu = $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); + $moduleTemplate = $this->moduleTemplateFactory->create($this->request); + $menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); $menu->setIdentifier('auth0'); $actions = [ @@ -92,28 +94,30 @@ protected function createMenu(): void ); } - $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu); + $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu); } protected function createButtonBar(): void { - $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); + $moduleTemplate = $this->moduleTemplateFactory->create($this->request); + $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); $listButton = $buttonBar->makeLinkButton() ->setTitle($this->getTranslation('menu.button.overview')) ->setHref($this->getUriBuilder()->reset()->uriFor('list', [], 'Backend')) - ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-viewmode-tiles', Icon::SIZE_SMALL)); + ->setIcon($moduleTemplate->getIconFactory()->getIcon('actions-viewmode-tiles', Icon::SIZE_SMALL)); $buttonBar->addButton($listButton, ButtonBar::BUTTON_POSITION_LEFT); } protected function addButton(string $label, string $actionName, string $controllerName, string $icon): void { - $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); + $moduleTemplate = $this->moduleTemplateFactory->create($this->request); + $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); $linkButton = $buttonBar->makeLinkButton() ->setTitle($this->getTranslation($label)) ->setHref($this->getUriBuilder()->reset()->uriFor($actionName, [], $controllerName)) - ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon($icon, Icon::SIZE_SMALL)); + ->setIcon($moduleTemplate->getIconFactory()->getIcon($icon, Icon::SIZE_SMALL)); $buttonBar->addButton($linkButton, ButtonBar::BUTTON_POSITION_RIGHT); } diff --git a/Classes/Controller/LoginController.php b/Classes/Controller/LoginController.php index c03de4a4..8369b820 100644 --- a/Classes/Controller/LoginController.php +++ b/Classes/Controller/LoginController.php @@ -13,6 +13,7 @@ namespace Bitmotion\Auth0\Controller; +use Psr\Http\Message\ResponseInterface; use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ConfigurationException; use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; @@ -62,7 +63,7 @@ public function initializeAction(): void /** * @throws AspectNotFoundException */ - public function formAction(): void + public function formAction(): ResponseInterface { if (GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'isLoggedIn')) { // Get Auth0 user from session storage @@ -75,6 +76,7 @@ public function formAction(): void 'auth0Error' => $this->error, 'auth0ErrorDescription' => $this->errorDescription, ]); + return $this->htmlResponse(); } /** diff --git a/Classes/Controller/PropertyController.php b/Classes/Controller/PropertyController.php index 48845f0f..9481b4f1 100644 --- a/Classes/Controller/PropertyController.php +++ b/Classes/Controller/PropertyController.php @@ -11,6 +11,8 @@ namespace Bitmotion\Auth0\Controller; +use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Extbase\Http\ForwardResponse; use Bitmotion\Auth0\Configuration\Auth0Configuration; use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; use Bitmotion\Auth0\Factory\ConfigurationFactory; @@ -20,7 +22,7 @@ class PropertyController extends BackendController { - public function listAction(): void + public function listAction(): ResponseInterface { $tcaUtility = new TcaUtility(); @@ -30,9 +32,10 @@ public function listAction(): void 'extensionConfiguration' => new EmAuth0Configuration(), 'yamlConfiguration' => GeneralUtility::makeInstance(Auth0Configuration::class)->load(), ]); + return $this->htmlResponse(); } - public function newAction(string $table, string $type): void + public function newAction(string $table, string $type): ResponseInterface { $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close'); $this->view->assignMultiple([ @@ -40,15 +43,16 @@ public function newAction(string $table, string $type): void 'type' => $type, 'properties' => (new TcaUtility())->getUnusedColumnsFromTable($table), ]); + return $this->htmlResponse(); } /** * @throws StopActionException */ - public function createAction(array $property, string $table, string $type): void + public function createAction(array $property, string $table, string $type) { if (empty($property['databaseField']) || empty($property['auth0Property'])) { - $this->forward('new'); + return new ForwardResponse('new'); } ksort($property); @@ -85,7 +89,7 @@ public function deleteAction(array $property, string $table, string $type): void $this->redirect('list'); } - public function editAction(array $property, string $table, string $type): void + public function editAction(array $property, string $table, string $type): ResponseInterface { $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close'); $this->view->assignMultiple([ @@ -94,6 +98,7 @@ public function editAction(array $property, string $table, string $type): void 'type' => $type, 'properties' => (new TcaUtility())->getUnusedColumnsFromTable($table, $property['databaseField']), ]); + return $this->htmlResponse(); } /** diff --git a/Classes/Controller/RoleController.php b/Classes/Controller/RoleController.php index 909ccc6b..74dde913 100644 --- a/Classes/Controller/RoleController.php +++ b/Classes/Controller/RoleController.php @@ -21,7 +21,7 @@ class RoleController extends BackendController { - public function listAction(): void + public function listAction(): ResponseInterface { $this->view->assignMultiple([ 'frontendUserGroupMapping' => (new FrontendUserGroupRepository())->findAll(), @@ -29,6 +29,7 @@ public function listAction(): void 'extensionConfiguration' => new EmAuth0Configuration(), 'yamlConfiguration' => GeneralUtility::makeInstance(Auth0Configuration::class)->load(), ]); + return $this->htmlResponse(); } /** diff --git a/Classes/Middleware/CallbackMiddleware.php b/Classes/Middleware/CallbackMiddleware.php index 561fba09..129a7203 100644 --- a/Classes/Middleware/CallbackMiddleware.php +++ b/Classes/Middleware/CallbackMiddleware.php @@ -13,6 +13,8 @@ namespace Bitmotion\Auth0\Middleware; +use Auth0\SDK\Exception\ConfigurationException; +use GuzzleHttp\Exception\GuzzleException; use Auth0\SDK\Exception\ArgumentException; use Auth0\SDK\Exception\NetworkException; use Auth0\SDK\Utility\HttpResponse; @@ -183,8 +185,8 @@ protected function isUserLoggedIn(ServerRequestInterface $request): bool /** * @throws ArgumentException * @throws NetworkException - * @throws \Auth0\SDK\Exception\ConfigurationException - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws ConfigurationException + * @throws GuzzleException */ protected function updateTypo3User(int $applicationId, array $user): void { diff --git a/Classes/Service/RedirectService.php b/Classes/Service/RedirectService.php index e10dcb37..dbacb453 100644 --- a/Classes/Service/RedirectService.php +++ b/Classes/Service/RedirectService.php @@ -267,10 +267,7 @@ protected function isRelativeUrl($url) $parsedUrl = @parse_url($url); if ($parsedUrl !== false && !isset($parsedUrl['scheme']) && !isset($parsedUrl['host'])) { // If the relative URL starts with a slash, we need to check if it's within the current site path - return $parsedUrl['path'][0] !== '/' || GeneralUtility::isFirstPartOfStr( - $parsedUrl['path'], - GeneralUtility::getIndpEnv('TYPO3_SITE_PATH') - ); + return $parsedUrl['path'][0] !== '/' || \str_starts_with($parsedUrl['path'], GeneralUtility::getIndpEnv('TYPO3_SITE_PATH')); } return false; @@ -288,8 +285,8 @@ protected function isInCurrentDomain($url) $urlWithoutSchema = preg_replace('#^https?://#', '', $url); $siteUrlWithoutSchema = preg_replace('#^https?://#', '', GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); - return StringUtility::beginsWith($urlWithoutSchema . '/', GeneralUtility::getIndpEnv('HTTP_HOST') . '/') - && StringUtility::beginsWith($urlWithoutSchema, $siteUrlWithoutSchema); + return \str_starts_with($urlWithoutSchema . '/', GeneralUtility::getIndpEnv('HTTP_HOST') . '/') + && \str_starts_with($urlWithoutSchema, $siteUrlWithoutSchema); } /** @@ -319,7 +316,7 @@ protected function isInLocalDomain(string $url): bool foreach ($localDomains as $localDomain) { // strip trailing slashes (if given) $domainName = rtrim($localDomain['domainName'], '/'); - if (GeneralUtility::isFirstPartOfStr($host . $path . '/', $domainName . '/')) { + if (\str_starts_with($host . $path . '/', $domainName . '/')) { return true; } } diff --git a/Classes/Utility/TokenUtility.php b/Classes/Utility/TokenUtility.php index a3921b75..a4411e96 100644 --- a/Classes/Utility/TokenUtility.php +++ b/Classes/Utility/TokenUtility.php @@ -13,6 +13,7 @@ namespace Bitmotion\Auth0\Utility; +use TYPO3\CMS\Core\Http\ApplicationType; use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; use Bitmotion\Auth0\Exception\TokenException; use Bitmotion\Auth0\Middleware\CallbackMiddleware; @@ -160,7 +161,7 @@ protected function setIssuer(): void { $environmentService = GeneralUtility::makeInstance(EnvironmentService::class); - if ($environmentService->isEnvironmentInFrontendMode()) { + if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { try { $pageId = (int)$GLOBALS['TSFE']->id; $base = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pageId)->getBase(); @@ -175,7 +176,7 @@ protected function setIssuer(): void $this->issuer = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); } $this->withPayload('environment', self::ENVIRONMENT_FRONTEND); - } elseif ($environmentService->isEnvironmentInBackendMode()) { + } elseif (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) { $this->issuer = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); $this->withPayload('environment', self::ENVIRONMENT_BACKEND); } diff --git a/Configuration/RequestMiddlewares.php b/Configuration/RequestMiddlewares.php index 1ec5bba7..d346d31f 100644 --- a/Configuration/RequestMiddlewares.php +++ b/Configuration/RequestMiddlewares.php @@ -1,10 +1,12 @@ [ 'bitmotion/auth0/callback' => [ - 'target' => \Bitmotion\Auth0\Middleware\CallbackMiddleware::class, + 'target' => CallbackMiddleware::class, 'after' => [ 'typo3/cms-frontend/authentication', ], diff --git a/Configuration/TCA/Overrides/be_groups.php b/Configuration/TCA/Overrides/be_groups.php index b8b544d4..7f6a649b 100644 --- a/Configuration/TCA/Overrides/be_groups.php +++ b/Configuration/TCA/Overrides/be_groups.php @@ -1,11 +1,15 @@ [ + AbstractUserGroupRepository::USER_GROUP_FIELD => [ 'exclude' => 1, 'label' => 'LLL:EXT:auth0/Resources/Private/Language/Database.xlf:fe_groups.auth0_user_group', 'config' => [ @@ -17,11 +21,11 @@ ] ); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( - \Bitmotion\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository::TABLE_NAME, +ExtensionManagementUtility::addToAllTCAtypes( + BackendUserGroupRepository::TABLE_NAME, sprintf( '--div--;LLL:EXT:auth0/Resources/Private/Language/Database.xlf:tabs.auth0,%s', - \Bitmotion\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository::USER_GROUP_FIELD + AbstractUserGroupRepository::USER_GROUP_FIELD ), '0', 'after:description' diff --git a/Configuration/TCA/Overrides/be_users.php b/Configuration/TCA/Overrides/be_users.php index 6029bbd8..e896ffb2 100644 --- a/Configuration/TCA/Overrides/be_users.php +++ b/Configuration/TCA/Overrides/be_users.php @@ -1,8 +1,10 @@ [ diff --git a/Configuration/TCA/Overrides/fe_groups.php b/Configuration/TCA/Overrides/fe_groups.php index f39e8263..d8036ab4 100644 --- a/Configuration/TCA/Overrides/fe_groups.php +++ b/Configuration/TCA/Overrides/fe_groups.php @@ -1,11 +1,15 @@ [ + AbstractUserGroupRepository::USER_GROUP_FIELD => [ 'exclude' => 1, 'label' => 'LLL:EXT:auth0/Resources/Private/Language/Database.xlf:fe_groups.auth0_user_group', 'config' => [ @@ -17,11 +21,11 @@ ] ); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( - \Bitmotion\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository::TABLE_NAME, +ExtensionManagementUtility::addToAllTCAtypes( + FrontendUserGroupRepository::TABLE_NAME, sprintf( '--div--;LLL:EXT:auth0/Resources/Private/Language/Database.xlf:tabs.auth0,%s', - \Bitmotion\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository::USER_GROUP_FIELD + AbstractUserGroupRepository::USER_GROUP_FIELD ), '0,Tx_Extbase_Domain_Model_FrontendUserGroup', 'after:description' diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php index 8cb6c2de..1fc073ad 100644 --- a/Configuration/TCA/Overrides/fe_users.php +++ b/Configuration/TCA/Overrides/fe_users.php @@ -1,8 +1,10 @@ [ diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php index 2586f01e..f94a89b1 100644 --- a/Configuration/TCA/Overrides/sys_template.php +++ b/Configuration/TCA/Overrides/sys_template.php @@ -1,8 +1,10 @@ isEnableFrontendLogin()) { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + ExtensionUtility::registerPlugin( 'Auth0', 'LoginForm', 'Auth0: Login form' @@ -24,7 +28,7 @@ $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['auth0_loginform'] = 'pi_flexform'; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['auth0_loginform'] = 'layout,select_key,pages,recursive'; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( +ExtensionManagementUtility::addPiFlexFormValue( 'auth0_loginform', 'FILE:EXT:auth0/Configuration/FlexForms/LoginForm.xml' ); diff --git a/ext_emconf.php b/ext_emconf.php index 540517e7..310c227a 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -13,7 +13,6 @@ 'suggests' => [], ], 'state' => 'stable', - 'clearCacheOnLoad' => true, 'author' => 'Max Rösch', 'author_email' => 'm.roesch@Leuchtfeuer.com', 'author_company' => 'Leuchtfeuer Digital Marketing', diff --git a/ext_localconf.php b/ext_localconf.php index 36d8fc66..75b2113f 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,6 +1,6 @@ Date: Thu, 7 Sep 2023 11:26:15 +0200 Subject: [PATCH 03/16] [TASK]Remove Bitmotion as namespace --- .gitignore | 2 ++ Classes/Command/CleanUpCommand.php | 6 ++--- Classes/Configuration/Auth0Configuration.php | 4 ++-- Classes/Controller/ApplicationController.php | 6 ++--- Classes/Controller/BackendController.php | 4 ++-- Classes/Controller/LoginController.php | 16 ++++++------- Classes/Controller/PropertyController.php | 10 ++++---- Classes/Controller/RoleController.php | 12 +++++----- Classes/Domain/Model/Application.php | 2 +- .../Repository/ApplicationRepository.php | 4 ++-- .../Repository/FrontendUserRepository.php | 2 +- .../UserGroup/AbstractUserGroupRepository.php | 2 +- .../UserGroup/BackendUserGroupRepository.php | 2 +- .../UserGroup/FrontendUserGroupRepository.php | 2 +- Classes/Domain/Repository/UserRepository.php | 4 ++-- .../Domain/Transfer/EmAuth0Configuration.php | 4 ++-- Classes/ErrorCode.php | 2 +- Classes/Event/RedirectPreProcessingEvent.php | 4 ++-- .../EventListener/AfterPackageActivation.php | 2 +- Classes/Exception/TokenException.php | 2 +- .../Exception/UnknownErrorCodeException.php | 2 +- Classes/Factory/ApplicationFactory.php | 8 +++---- Classes/Factory/ConfigurationFactory.php | 2 +- Classes/Hooks/PageLayoutViewHook.php | 2 +- Classes/Hooks/SingleSignOutHook.php | 4 ++-- Classes/LoginProvider/Auth0Provider.php | 14 +++++------ Classes/Middleware/CallbackMiddleware.php | 24 +++++++++---------- Classes/Service/AuthenticationService.php | 20 ++++++++-------- Classes/Service/RedirectService.php | 4 ++-- Classes/Utility/Database/UpdateUtility.php | 18 +++++++------- Classes/Utility/ParametersUtility.php | 2 +- Classes/Utility/ParseFuncUtility.php | 4 ++-- Classes/Utility/RoutingUtility.php | 2 +- Classes/Utility/TcaUtility.php | 4 ++-- Classes/Utility/TokenUtility.php | 8 +++---- Classes/Utility/UserUtility.php | 10 ++++---- Configuration/RequestMiddlewares.php | 4 ++-- Configuration/Services.yaml | 6 ++--- Configuration/TCA/Overrides/be_groups.php | 4 ++-- Configuration/TCA/Overrides/fe_groups.php | 4 ++-- Configuration/TCA/Overrides/tt_content.php | 2 +- .../TCA/tx_auth0_domain_model_application.php | 2 +- ext_emconf.php | 4 ++-- ext_localconf.php | 10 ++++---- ext_tables.php | 20 ++++++++-------- 45 files changed, 139 insertions(+), 137 deletions(-) diff --git a/.gitignore b/.gitignore index f878b453..0057423a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /Tests/Build/.phpunit.result.cache /Libraries/vendor /composer.lock +/rector.php +/.idea \ No newline at end of file diff --git a/Classes/Command/CleanUpCommand.php b/Classes/Command/CleanUpCommand.php index 16d4a61c..34511db5 100644 --- a/Classes/Command/CleanUpCommand.php +++ b/Classes/Command/CleanUpCommand.php @@ -11,12 +11,12 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Command; +namespace Leuchtfeuer\Auth0\Command; use Auth0\SDK\Exception\ArgumentException; use Auth0\SDK\Exception\NetworkException; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Factory\ApplicationFactory; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver\Exception; use GuzzleHttp\Exception\GuzzleException; diff --git a/Classes/Configuration/Auth0Configuration.php b/Classes/Configuration/Auth0Configuration.php index 255111d4..1831e69b 100644 --- a/Classes/Configuration/Auth0Configuration.php +++ b/Classes/Configuration/Auth0Configuration.php @@ -9,9 +9,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Configuration; +namespace Leuchtfeuer\Auth0\Configuration; -use Bitmotion\Auth0\Factory\ConfigurationFactory; +use Leuchtfeuer\Auth0\Factory\ConfigurationFactory; use Symfony\Component\Yaml\Yaml; use TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader; use TYPO3\CMS\Core\Core\Environment; diff --git a/Classes/Controller/ApplicationController.php b/Classes/Controller/ApplicationController.php index eefa84fb..c3564e9e 100644 --- a/Classes/Controller/ApplicationController.php +++ b/Classes/Controller/ApplicationController.php @@ -9,11 +9,11 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Controller; +namespace Leuchtfeuer\Auth0\Controller; use Psr\Http\Message\ResponseInterface; -use Bitmotion\Auth0\Domain\Model\Application; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Domain\Model\Application; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index db25f72e..c7ec29da 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -9,11 +9,11 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Controller; +namespace Leuchtfeuer\Auth0\Controller; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use Psr\Http\Message\ResponseInterface; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder; use TYPO3\CMS\Backend\Template\Components\ButtonBar; diff --git a/Classes/Controller/LoginController.php b/Classes/Controller/LoginController.php index 8369b820..ce10bc95 100644 --- a/Classes/Controller/LoginController.php +++ b/Classes/Controller/LoginController.php @@ -11,18 +11,18 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Controller; +namespace Leuchtfeuer\Auth0\Controller; use Psr\Http\Message\ResponseInterface; use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ConfigurationException; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Factory\ApplicationFactory; -use Bitmotion\Auth0\Middleware\CallbackMiddleware; -use Bitmotion\Auth0\Utility\ParametersUtility; -use Bitmotion\Auth0\Utility\RoutingUtility; -use Bitmotion\Auth0\Utility\TokenUtility; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Utility\ParametersUtility; +use Leuchtfeuer\Auth0\Utility\RoutingUtility; +use Leuchtfeuer\Auth0\Utility\TokenUtility; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Core\Context\Context; diff --git a/Classes/Controller/PropertyController.php b/Classes/Controller/PropertyController.php index 9481b4f1..e2e7990e 100644 --- a/Classes/Controller/PropertyController.php +++ b/Classes/Controller/PropertyController.php @@ -9,14 +9,14 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Controller; +namespace Leuchtfeuer\Auth0\Controller; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Extbase\Http\ForwardResponse; -use Bitmotion\Auth0\Configuration\Auth0Configuration; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Factory\ConfigurationFactory; -use Bitmotion\Auth0\Utility\TcaUtility; +use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ConfigurationFactory; +use Leuchtfeuer\Auth0\Utility\TcaUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; diff --git a/Classes/Controller/RoleController.php b/Classes/Controller/RoleController.php index 74dde913..f47ce7a0 100644 --- a/Classes/Controller/RoleController.php +++ b/Classes/Controller/RoleController.php @@ -9,13 +9,13 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Controller; +namespace Leuchtfeuer\Auth0\Controller; -use Bitmotion\Auth0\Configuration\Auth0Configuration; -use Bitmotion\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Factory\ConfigurationFactory; +use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ConfigurationFactory; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; diff --git a/Classes/Domain/Model/Application.php b/Classes/Domain/Model/Application.php index f54e76c5..9bcd991a 100644 --- a/Classes/Domain/Model/Application.php +++ b/Classes/Domain/Model/Application.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Model; +namespace Leuchtfeuer\Auth0\Domain\Model; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; diff --git a/Classes/Domain/Repository/ApplicationRepository.php b/Classes/Domain/Repository/ApplicationRepository.php index 02162543..6d4e4f3c 100644 --- a/Classes/Domain/Repository/ApplicationRepository.php +++ b/Classes/Domain/Repository/ApplicationRepository.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository; +namespace Leuchtfeuer\Auth0\Domain\Repository; -use Bitmotion\Auth0\Domain\Model\Application; +use Leuchtfeuer\Auth0\Domain\Model\Application; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; diff --git a/Classes/Domain/Repository/FrontendUserRepository.php b/Classes/Domain/Repository/FrontendUserRepository.php index c8574873..cbde3469 100644 --- a/Classes/Domain/Repository/FrontendUserRepository.php +++ b/Classes/Domain/Repository/FrontendUserRepository.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository; +namespace Leuchtfeuer\Auth0\Domain\Repository; use TYPO3\CMS\Extbase\Persistence\Repository; diff --git a/Classes/Domain/Repository/UserGroup/AbstractUserGroupRepository.php b/Classes/Domain/Repository/UserGroup/AbstractUserGroupRepository.php index 3e4f7e0b..c0a2720d 100644 --- a/Classes/Domain/Repository/UserGroup/AbstractUserGroupRepository.php +++ b/Classes/Domain/Repository/UserGroup/AbstractUserGroupRepository.php @@ -9,7 +9,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository\UserGroup; +namespace Leuchtfeuer\Auth0\Domain\Repository\UserGroup; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; diff --git a/Classes/Domain/Repository/UserGroup/BackendUserGroupRepository.php b/Classes/Domain/Repository/UserGroup/BackendUserGroupRepository.php index b9092916..1eb5f5a1 100644 --- a/Classes/Domain/Repository/UserGroup/BackendUserGroupRepository.php +++ b/Classes/Domain/Repository/UserGroup/BackendUserGroupRepository.php @@ -9,7 +9,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository\UserGroup; +namespace Leuchtfeuer\Auth0\Domain\Repository\UserGroup; class BackendUserGroupRepository extends AbstractUserGroupRepository { diff --git a/Classes/Domain/Repository/UserGroup/FrontendUserGroupRepository.php b/Classes/Domain/Repository/UserGroup/FrontendUserGroupRepository.php index 3a13ec2a..1fa2d92b 100644 --- a/Classes/Domain/Repository/UserGroup/FrontendUserGroupRepository.php +++ b/Classes/Domain/Repository/UserGroup/FrontendUserGroupRepository.php @@ -9,7 +9,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository\UserGroup; +namespace Leuchtfeuer\Auth0\Domain\Repository\UserGroup; class FrontendUserGroupRepository extends AbstractUserGroupRepository { diff --git a/Classes/Domain/Repository/UserRepository.php b/Classes/Domain/Repository/UserRepository.php index aafb56e5..c3bb3080 100644 --- a/Classes/Domain/Repository/UserRepository.php +++ b/Classes/Domain/Repository/UserRepository.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Repository; +namespace Leuchtfeuer\Auth0\Domain\Repository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Psr\Http\Message\ServerRequestInterface; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; diff --git a/Classes/Domain/Transfer/EmAuth0Configuration.php b/Classes/Domain/Transfer/EmAuth0Configuration.php index 0c071179..d1acf6ce 100644 --- a/Classes/Domain/Transfer/EmAuth0Configuration.php +++ b/Classes/Domain/Transfer/EmAuth0Configuration.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Domain\Transfer; +namespace Leuchtfeuer\Auth0\Domain\Transfer; -use Bitmotion\Auth0\Utility\ParametersUtility; +use Leuchtfeuer\Auth0\Utility\ParametersUtility; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; diff --git a/Classes/ErrorCode.php b/Classes/ErrorCode.php index 3c70b105..5bbb7d47 100644 --- a/Classes/ErrorCode.php +++ b/Classes/ErrorCode.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0; +namespace Leuchtfeuer\Auth0; final class ErrorCode { diff --git a/Classes/Event/RedirectPreProcessingEvent.php b/Classes/Event/RedirectPreProcessingEvent.php index 1d0709af..8127b7e4 100644 --- a/Classes/Event/RedirectPreProcessingEvent.php +++ b/Classes/Event/RedirectPreProcessingEvent.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Event; +namespace Leuchtfeuer\Auth0\Event; -use Bitmotion\Auth0\Service\RedirectService; +use Leuchtfeuer\Auth0\Service\RedirectService; final class RedirectPreProcessingEvent { diff --git a/Classes/EventListener/AfterPackageActivation.php b/Classes/EventListener/AfterPackageActivation.php index 4eb6d107..ac233095 100644 --- a/Classes/EventListener/AfterPackageActivation.php +++ b/Classes/EventListener/AfterPackageActivation.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\EventListener; +namespace Leuchtfeuer\Auth0\EventListener; use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Package\Event\AfterPackageActivationEvent; diff --git a/Classes/Exception/TokenException.php b/Classes/Exception/TokenException.php index 4aea981a..8c4e85b3 100644 --- a/Classes/Exception/TokenException.php +++ b/Classes/Exception/TokenException.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Exception; +namespace Leuchtfeuer\Auth0\Exception; class TokenException extends \Exception { diff --git a/Classes/Exception/UnknownErrorCodeException.php b/Classes/Exception/UnknownErrorCodeException.php index 8f8b27aa..08f3edd0 100644 --- a/Classes/Exception/UnknownErrorCodeException.php +++ b/Classes/Exception/UnknownErrorCodeException.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Exception; +namespace Leuchtfeuer\Auth0\Exception; class UnknownErrorCodeException extends \Exception { diff --git a/Classes/Factory/ApplicationFactory.php b/Classes/Factory/ApplicationFactory.php index 85826e05..b4266ee3 100644 --- a/Classes/Factory/ApplicationFactory.php +++ b/Classes/Factory/ApplicationFactory.php @@ -9,14 +9,14 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Factory; +namespace Leuchtfeuer\Auth0\Factory; use Auth0\SDK\Auth0; use Auth0\SDK\Configuration\SdkConfiguration; use Auth0\SDK\Exception\ConfigurationException; -use Bitmotion\Auth0\Domain\Model\Application; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; -use Bitmotion\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Domain\Model\Application; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use TYPO3\CMS\Core\Utility\GeneralUtility; diff --git a/Classes/Factory/ConfigurationFactory.php b/Classes/Factory/ConfigurationFactory.php index 887bcdc8..314adcac 100644 --- a/Classes/Factory/ConfigurationFactory.php +++ b/Classes/Factory/ConfigurationFactory.php @@ -9,7 +9,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Factory; +namespace Leuchtfeuer\Auth0\Factory; class ConfigurationFactory { diff --git a/Classes/Hooks/PageLayoutViewHook.php b/Classes/Hooks/PageLayoutViewHook.php index d9cd5de5..3e9c1021 100644 --- a/Classes/Hooks/PageLayoutViewHook.php +++ b/Classes/Hooks/PageLayoutViewHook.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Hooks; +namespace Leuchtfeuer\Auth0\Hooks; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Localization\LanguageService; diff --git a/Classes/Hooks/SingleSignOutHook.php b/Classes/Hooks/SingleSignOutHook.php index bc9b4223..1a59e473 100644 --- a/Classes/Hooks/SingleSignOutHook.php +++ b/Classes/Hooks/SingleSignOutHook.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Hooks; +namespace Leuchtfeuer\Auth0\Hooks; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Http\ApplicationType; use TYPO3\CMS\Core\SingletonInterface; diff --git a/Classes/LoginProvider/Auth0Provider.php b/Classes/LoginProvider/Auth0Provider.php index 24424be3..06924a60 100644 --- a/Classes/LoginProvider/Auth0Provider.php +++ b/Classes/LoginProvider/Auth0Provider.php @@ -11,16 +11,16 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\LoginProvider; +namespace Leuchtfeuer\Auth0\LoginProvider; use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ConfigurationException; -use Bitmotion\Auth0\Domain\Model\Application; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Factory\ApplicationFactory; -use Bitmotion\Auth0\Middleware\CallbackMiddleware; -use Bitmotion\Auth0\Utility\TokenUtility; +use Leuchtfeuer\Auth0\Domain\Model\Application; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Utility\TokenUtility; use GuzzleHttp\Exception\GuzzleException; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; diff --git a/Classes/Middleware/CallbackMiddleware.php b/Classes/Middleware/CallbackMiddleware.php index 129a7203..7810c3e9 100644 --- a/Classes/Middleware/CallbackMiddleware.php +++ b/Classes/Middleware/CallbackMiddleware.php @@ -11,24 +11,24 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Middleware; +namespace Leuchtfeuer\Auth0\Middleware; use Auth0\SDK\Exception\ConfigurationException; use GuzzleHttp\Exception\GuzzleException; use Auth0\SDK\Exception\ArgumentException; use Auth0\SDK\Exception\NetworkException; use Auth0\SDK\Utility\HttpResponse; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\ErrorCode; -use Bitmotion\Auth0\Exception\TokenException; -use Bitmotion\Auth0\Exception\UnknownErrorCodeException; -use Bitmotion\Auth0\Factory\ApplicationFactory; -use Bitmotion\Auth0\LoginProvider\Auth0Provider; -use Bitmotion\Auth0\Service\RedirectService; -use Bitmotion\Auth0\Utility\Database\UpdateUtility; -use Bitmotion\Auth0\Utility\TokenUtility; -use Bitmotion\Auth0\Utility\UserUtility; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\ErrorCode; +use Leuchtfeuer\Auth0\Exception\TokenException; +use Leuchtfeuer\Auth0\Exception\UnknownErrorCodeException; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; +use Leuchtfeuer\Auth0\LoginProvider\Auth0Provider; +use Leuchtfeuer\Auth0\Service\RedirectService; +use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; +use Leuchtfeuer\Auth0\Utility\TokenUtility; +use Leuchtfeuer\Auth0\Utility\UserUtility; use Lcobucci\JWT\Token\DataSet; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/Classes/Service/AuthenticationService.php b/Classes/Service/AuthenticationService.php index 44bfa835..38a77b2e 100644 --- a/Classes/Service/AuthenticationService.php +++ b/Classes/Service/AuthenticationService.php @@ -11,22 +11,22 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Service; +namespace Leuchtfeuer\Auth0\Service; use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ArgumentException; use Auth0\SDK\Exception\NetworkException; use Auth0\SDK\Utility\HttpResponse; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\ErrorCode; -use Bitmotion\Auth0\Exception\TokenException; -use Bitmotion\Auth0\Factory\ApplicationFactory; -use Bitmotion\Auth0\LoginProvider\Auth0Provider; -use Bitmotion\Auth0\Middleware\CallbackMiddleware; -use Bitmotion\Auth0\Utility\Database\UpdateUtility; -use Bitmotion\Auth0\Utility\TokenUtility; -use Bitmotion\Auth0\Utility\UserUtility; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\ErrorCode; +use Leuchtfeuer\Auth0\Exception\TokenException; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; +use Leuchtfeuer\Auth0\LoginProvider\Auth0Provider; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; +use Leuchtfeuer\Auth0\Utility\TokenUtility; +use Leuchtfeuer\Auth0\Utility\UserUtility; use GuzzleHttp\Exception\GuzzleException; use JsonException; use TYPO3\CMS\Core\Authentication\AuthenticationService as BasicAuthenticationService; diff --git a/Classes/Service/RedirectService.php b/Classes/Service/RedirectService.php index dbacb453..718b9ed5 100644 --- a/Classes/Service/RedirectService.php +++ b/Classes/Service/RedirectService.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Service; +namespace Leuchtfeuer\Auth0\Service; -use Bitmotion\Auth0\Event\RedirectPreProcessingEvent; +use Leuchtfeuer\Auth0\Event\RedirectPreProcessingEvent; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; diff --git a/Classes/Utility/Database/UpdateUtility.php b/Classes/Utility/Database/UpdateUtility.php index 0f6aaae5..4afb8f45 100644 --- a/Classes/Utility/Database/UpdateUtility.php +++ b/Classes/Utility/Database/UpdateUtility.php @@ -11,15 +11,15 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility\Database; - -use Bitmotion\Auth0\Configuration\Auth0Configuration; -use Bitmotion\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Utility\ParseFuncUtility; +namespace Leuchtfeuer\Auth0\Utility\Database; + +use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Utility\ParseFuncUtility; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Backend\Utility\BackendUtility; diff --git a/Classes/Utility/ParametersUtility.php b/Classes/Utility/ParametersUtility.php index 66a7f5b3..66412978 100644 --- a/Classes/Utility/ParametersUtility.php +++ b/Classes/Utility/ParametersUtility.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; class ParametersUtility { diff --git a/Classes/Utility/ParseFuncUtility.php b/Classes/Utility/ParseFuncUtility.php index 692dd7d9..04417968 100644 --- a/Classes/Utility/ParseFuncUtility.php +++ b/Classes/Utility/ParseFuncUtility.php @@ -11,9 +11,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; -use Bitmotion\Auth0\Configuration\Auth0Configuration; +use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Core\SingletonInterface; diff --git a/Classes/Utility/RoutingUtility.php b/Classes/Utility/RoutingUtility.php index 03e8aa76..58e8e1fb 100644 --- a/Classes/Utility/RoutingUtility.php +++ b/Classes/Utility/RoutingUtility.php @@ -11,7 +11,7 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; diff --git a/Classes/Utility/TcaUtility.php b/Classes/Utility/TcaUtility.php index e8da57f6..a11229e2 100644 --- a/Classes/Utility/TcaUtility.php +++ b/Classes/Utility/TcaUtility.php @@ -9,9 +9,9 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; -use Bitmotion\Auth0\Configuration\Auth0Configuration; +use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; use TYPO3\CMS\Core\Utility\GeneralUtility; class TcaUtility diff --git a/Classes/Utility/TokenUtility.php b/Classes/Utility/TokenUtility.php index a4411e96..ad0808dc 100644 --- a/Classes/Utility/TokenUtility.php +++ b/Classes/Utility/TokenUtility.php @@ -11,12 +11,12 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; use TYPO3\CMS\Core\Http\ApplicationType; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Exception\TokenException; -use Bitmotion\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Exception\TokenException; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; use DateTimeImmutable; use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer; diff --git a/Classes/Utility/UserUtility.php b/Classes/Utility/UserUtility.php index b0656c3d..10932d89 100644 --- a/Classes/Utility/UserUtility.php +++ b/Classes/Utility/UserUtility.php @@ -11,14 +11,14 @@ * Florian Wessels , Leuchtfeuer Digital Marketing */ -namespace Bitmotion\Auth0\Utility; +namespace Leuchtfeuer\Auth0\Utility; use Auth0\SDK\Auth0; use Auth0\SDK\Utility\HttpResponse; -use Bitmotion\Auth0\Domain\Repository\ApplicationRepository; -use Bitmotion\Auth0\Domain\Repository\UserRepository; -use Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration; -use Bitmotion\Auth0\Utility\Database\UpdateUtility; +use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserRepository; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; use GuzzleHttp\Utils; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; diff --git a/Configuration/RequestMiddlewares.php b/Configuration/RequestMiddlewares.php index d346d31f..c75d8c4d 100644 --- a/Configuration/RequestMiddlewares.php +++ b/Configuration/RequestMiddlewares.php @@ -1,11 +1,11 @@ [ - 'bitmotion/auth0/callback' => [ + 'leuchtfeuer/auth0/callback' => [ 'target' => CallbackMiddleware::class, 'after' => [ 'typo3/cms-frontend/authentication', diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index b0cb313a..ff20f319 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -4,16 +4,16 @@ services: autoconfigure: true public: false - Bitmotion\Auth0\: + Leuchtfeuer\Auth0\: resource: '../Classes/*' - Bitmotion\Auth0\Command\CleanUpCommand: + Leuchtfeuer\Auth0\Command\CleanUpCommand: tags: - name: 'console.command' command: 'auth0:cleanupusers' description: 'Disable or remove obsolete website users.' - Bitmotion\Auth0\EventListener\AfterPackageActivation: + Leuchtfeuer\Auth0\EventListener\AfterPackageActivation: tags: - name: event.listener identifier: auth0AfterPackageActivationEvent diff --git a/Configuration/TCA/Overrides/be_groups.php b/Configuration/TCA/Overrides/be_groups.php index 7f6a649b..e884d522 100644 --- a/Configuration/TCA/Overrides/be_groups.php +++ b/Configuration/TCA/Overrides/be_groups.php @@ -2,8 +2,8 @@ declare(strict_types = 1); use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; -use Bitmotion\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\BackendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns( diff --git a/Configuration/TCA/Overrides/fe_groups.php b/Configuration/TCA/Overrides/fe_groups.php index d8036ab4..ed5bbea3 100644 --- a/Configuration/TCA/Overrides/fe_groups.php +++ b/Configuration/TCA/Overrides/fe_groups.php @@ -2,8 +2,8 @@ declare(strict_types = 1); use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; -use Bitmotion\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; -use Bitmotion\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\FrontendUserGroupRepository; +use Leuchtfeuer\Auth0\Domain\Repository\UserGroup\AbstractUserGroupRepository; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns( diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index ac35f202..b2b28c62 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,7 +1,7 @@ [ diff --git a/ext_emconf.php b/ext_emconf.php index 310c227a..0a60b8e7 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -18,12 +18,12 @@ 'author_company' => 'Leuchtfeuer Digital Marketing', 'autoload' => [ 'psr-4' => [ - 'Bitmotion\\Auth0\\' => 'Classes', + 'Leuchtfeuer\\Auth0\\' => 'Classes', ], ], 'autoload-dev' => [ 'psr-4' => [ - 'Bitmotion\\Auth0\\Tests\\' => 'Classes/Tests', + 'Leuchtfeuer\\Auth0\\Tests\\' => 'Classes/Tests', ], ], ]; diff --git a/ext_localconf.php b/ext_localconf.php index 75b2113f..5b193588 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -10,7 +10,7 @@ function ($extensionKey) { } // Load extension configuration - $configuration = new \Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration(); + $configuration = new \Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration(); // Get proper subtypes for authentication service $subtypes = []; @@ -22,8 +22,8 @@ function ($extensionKey) { \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( $extensionKey, 'LoginForm', - [\Bitmotion\Auth0\Controller\LoginController::class => 'form, login, logout'], - [\Bitmotion\Auth0\Controller\LoginController::class => 'form, login, logout'] + [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'], + [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'] ); } @@ -48,7 +48,7 @@ function ($extensionKey) { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService( $extensionKey, 'auth', - \Bitmotion\Auth0\Service\AuthenticationService::class, + \Leuchtfeuer\Auth0\Service\AuthenticationService::class, [ 'title' => 'Auth0 authentication', 'description' => 'Authentication with Auth0.', @@ -58,7 +58,7 @@ function ($extensionKey) { 'quality' => $overrulingPriority, 'os' => '', 'exec' => '', - 'className' => \Bitmotion\Auth0\Service\AuthenticationService::class + 'className' => \Leuchtfeuer\Auth0\Service\AuthenticationService::class ] ); } diff --git a/ext_tables.php b/ext_tables.php index 9d8099b5..3af06b8a 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -19,25 +19,25 @@ function ($extensionKey) { ); // Load extension configuration - $configuration = new \Bitmotion\Auth0\Domain\Transfer\EmAuth0Configuration(); + $configuration = new \Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration(); if ($configuration->isEnableFrontendLogin()) { // Register hook for showing plugin preview $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['auth0_loginform'][$extensionKey] - = \Bitmotion\Auth0\Hooks\PageLayoutViewHook::class . '->getSummary'; + = \Leuchtfeuer\Auth0\Hooks\PageLayoutViewHook::class . '->getSummary'; } if ($configuration->isEnableBackendLogin()) { // Register single log out hooks // TODO: Support following hooks for frontend request as well and move to ext_localconf.php file $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][$extensionKey] - = \Bitmotion\Auth0\Hooks\SingleSignOutHook::class . '->isResponsible'; + = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->isResponsible'; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'][$extensionKey] - = \Bitmotion\Auth0\Hooks\SingleSignOutHook::class . '->performLogout'; + = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->performLogout'; // Register backend login provider - $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][\Bitmotion\Auth0\LoginProvider\Auth0Provider::LOGIN_PROVIDER] = [ - 'provider' => \Bitmotion\Auth0\LoginProvider\Auth0Provider::class, + $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][\Leuchtfeuer\Auth0\LoginProvider\Auth0Provider::LOGIN_PROVIDER] = [ + 'provider' => \Leuchtfeuer\Auth0\LoginProvider\Auth0Provider::class, 'sorting' => 25, 'icon-class' => 'fa-sign-in', 'label' => 'LLL:EXT:auth0/Resources/Private/Language/locallang.xlf:backendLogin.switch.label' @@ -51,10 +51,10 @@ function ($extensionKey) { 'Auth0', 'bottom', [ - \Bitmotion\Auth0\Controller\BackendController::class => 'list', - \Bitmotion\Auth0\Controller\ApplicationController::class => 'list,delete', - \Bitmotion\Auth0\Controller\RoleController::class => 'list,update', - \Bitmotion\Auth0\Controller\PropertyController::class => 'list,new,create,edit,update,delete', + \Leuchtfeuer\Auth0\Controller\BackendController::class => 'list', + \Leuchtfeuer\Auth0\Controller\ApplicationController::class => 'list,delete', + \Leuchtfeuer\Auth0\Controller\RoleController::class => 'list,update', + \Leuchtfeuer\Auth0\Controller\PropertyController::class => 'list,new,create,edit,update,delete', ], [ 'access' => 'admin', 'icon' => 'EXT:auth0/Resources/Public/Icons/Module.svg', From e8c641df300bb83ac2b2348f2b2f301cb49caae3 Mon Sep 17 00:00:00 2001 From: abid Date: Thu, 7 Sep 2023 13:45:07 +0200 Subject: [PATCH 04/16] [TASK]Backend login for 12 and remove support for 10 --- Classes/Command/CleanUpCommand.php | 4 +- Classes/Controller/ApplicationController.php | 2 +- Classes/Controller/BackendController.php | 4 +- Classes/Controller/LoginController.php | 2 +- Classes/Controller/PropertyController.php | 4 +- Classes/Factory/ApplicationFactory.php | 4 +- Classes/LoginProvider/Auth0Provider.php | 17 ++- Classes/Middleware/CallbackMiddleware.php | 6 +- Classes/Service/AuthenticationService.php | 22 +-- Classes/Service/RedirectService.php | 1 - Classes/Utility/ModeUtility.php | 38 +++++ Classes/Utility/TokenUtility.php | 20 +-- Classes/Utility/UserUtility.php | 2 +- Resources/Private/Layouts/LoginV12.html | 140 ++++++++++++++++++ .../Templates/LoginProvider/BackendV11.html | 53 +++++++ .../Templates/LoginProvider/BackendV12.html | 53 +++++++ ext_localconf.php | 111 +++++++------- ext_tables.php | 116 ++++++++------- 18 files changed, 447 insertions(+), 152 deletions(-) create mode 100644 Classes/Utility/ModeUtility.php create mode 100644 Resources/Private/Layouts/LoginV12.html create mode 100644 Resources/Private/Templates/LoginProvider/BackendV11.html create mode 100644 Resources/Private/Templates/LoginProvider/BackendV12.html diff --git a/Classes/Command/CleanUpCommand.php b/Classes/Command/CleanUpCommand.php index 34511db5..16b8906e 100644 --- a/Classes/Command/CleanUpCommand.php +++ b/Classes/Command/CleanUpCommand.php @@ -15,11 +15,11 @@ use Auth0\SDK\Exception\ArgumentException; use Auth0\SDK\Exception\NetworkException; -use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; -use Leuchtfeuer\Auth0\Factory\ApplicationFactory; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver\Exception; use GuzzleHttp\Exception\GuzzleException; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Factory\ApplicationFactory; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Symfony\Component\Console\Command\Command; diff --git a/Classes/Controller/ApplicationController.php b/Classes/Controller/ApplicationController.php index c3564e9e..28a42af4 100644 --- a/Classes/Controller/ApplicationController.php +++ b/Classes/Controller/ApplicationController.php @@ -11,9 +11,9 @@ namespace Leuchtfeuer\Auth0\Controller; -use Psr\Http\Message\ResponseInterface; use Leuchtfeuer\Auth0\Domain\Model\Application; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index c7ec29da..4ab0af1f 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -11,12 +11,12 @@ namespace Leuchtfeuer\Auth0\Controller; -use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; -use Psr\Http\Message\ResponseInterface; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; +use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder; use TYPO3\CMS\Backend\Template\Components\ButtonBar; +use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Backend\View\BackendTemplateView; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Localization\LanguageService; diff --git a/Classes/Controller/LoginController.php b/Classes/Controller/LoginController.php index ce10bc95..69c2c4f9 100644 --- a/Classes/Controller/LoginController.php +++ b/Classes/Controller/LoginController.php @@ -13,7 +13,6 @@ namespace Leuchtfeuer\Auth0\Controller; -use Psr\Http\Message\ResponseInterface; use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ConfigurationException; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; @@ -23,6 +22,7 @@ use Leuchtfeuer\Auth0\Utility\ParametersUtility; use Leuchtfeuer\Auth0\Utility\RoutingUtility; use Leuchtfeuer\Auth0\Utility\TokenUtility; +use Psr\Http\Message\ResponseInterface; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Core\Context\Context; diff --git a/Classes/Controller/PropertyController.php b/Classes/Controller/PropertyController.php index e2e7990e..67ae8bd5 100644 --- a/Classes/Controller/PropertyController.php +++ b/Classes/Controller/PropertyController.php @@ -11,13 +11,13 @@ namespace Leuchtfeuer\Auth0\Controller; -use Psr\Http\Message\ResponseInterface; -use TYPO3\CMS\Extbase\Http\ForwardResponse; use Leuchtfeuer\Auth0\Configuration\Auth0Configuration; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Leuchtfeuer\Auth0\Factory\ConfigurationFactory; use Leuchtfeuer\Auth0\Utility\TcaUtility; +use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Http\ForwardResponse; use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; class PropertyController extends BackendController diff --git a/Classes/Factory/ApplicationFactory.php b/Classes/Factory/ApplicationFactory.php index b4266ee3..f707bdc5 100644 --- a/Classes/Factory/ApplicationFactory.php +++ b/Classes/Factory/ApplicationFactory.php @@ -14,11 +14,11 @@ use Auth0\SDK\Auth0; use Auth0\SDK\Configuration\SdkConfiguration; use Auth0\SDK\Exception\ConfigurationException; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; use Leuchtfeuer\Auth0\Domain\Model\Application; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; -use GuzzleHttp\Client; -use GuzzleHttp\Exception\GuzzleException; use TYPO3\CMS\Core\Utility\GeneralUtility; class ApplicationFactory diff --git a/Classes/LoginProvider/Auth0Provider.php b/Classes/LoginProvider/Auth0Provider.php index 06924a60..7c16e5e9 100644 --- a/Classes/LoginProvider/Auth0Provider.php +++ b/Classes/LoginProvider/Auth0Provider.php @@ -15,13 +15,14 @@ use Auth0\SDK\Auth0; use Auth0\SDK\Exception\ConfigurationException; +use GuzzleHttp\Exception\GuzzleException; use Leuchtfeuer\Auth0\Domain\Model\Application; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Leuchtfeuer\Auth0\Factory\ApplicationFactory; use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; +use Leuchtfeuer\Auth0\Utility\ModeUtility; use Leuchtfeuer\Auth0\Utility\TokenUtility; -use GuzzleHttp\Exception\GuzzleException; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Backend\Controller\LoginController; @@ -123,6 +124,7 @@ protected function setAuth0(): bool protected function getCallback(?string $redirectUri = ''): string { $tokenUtility = new TokenUtility(); + $tokenUtility->setIssuer(ModeUtility::BACKEND_MODE); $tokenUtility->withPayload('application', $this->configuration->getBackendConnection()); if ($redirectUri !== '') { @@ -180,8 +182,7 @@ protected function isTypoScriptLoaded(): bool protected function prepareView(StandaloneView &$standaloneView, PageRenderer &$pageRenderer): void { - $templateName = version_compare(GeneralUtility::makeInstance(Typo3Version::class)->getVersion(), '11.0', '>=') ? 'BackendV11' : 'Backend'; - $standaloneView->setTemplate($templateName); + $standaloneView->setTemplate($this->getTemplateName()); $standaloneView->setLayoutRootPaths($this->frameworkConfiguration['view']['layoutRootPaths']); $standaloneView->setTemplateRootPaths($this->frameworkConfiguration['view']['templateRootPaths']); @@ -191,9 +192,8 @@ protected function prepareView(StandaloneView &$standaloneView, PageRenderer &$p protected function getDefaultView(StandaloneView &$standaloneView, PageRenderer &$pageRenderer): void { $standaloneView->setLayoutRootPaths(['EXT:auth0/Resources/Private/Layouts/']); - $templateName = version_compare(GeneralUtility::makeInstance(Typo3Version::class)->getVersion(), '11.0', '>=') ? 'BackendV11' : 'Backend'; $standaloneView->setTemplatePathAndFilename( - GeneralUtility::getFileAbsFileName('EXT:auth0/Resources/Private/Templates/' . $templateName . '.html') + GeneralUtility::getFileAbsFileName('EXT:auth0/Resources/Private/Templates/' . $this->getTemplateName() . '.html') ); $standaloneView->assign('error', 'no_typoscript'); $pageRenderer->addCssFile('EXT:auth0/Resources/Public/Styles/backend.css'); @@ -213,4 +213,11 @@ protected function logoutFromAuth0(): void } exit(); } + + private function getTemplateName(): string + { + $templateName = version_compare(GeneralUtility::makeInstance(Typo3Version::class)->getVersion(), '12.0', '>=') ? 'BackendV12' : 'BackendV11'; + + return 'LoginProvider/' . $templateName; + } } diff --git a/Classes/Middleware/CallbackMiddleware.php b/Classes/Middleware/CallbackMiddleware.php index 7810c3e9..8fa543ab 100644 --- a/Classes/Middleware/CallbackMiddleware.php +++ b/Classes/Middleware/CallbackMiddleware.php @@ -13,11 +13,12 @@ namespace Leuchtfeuer\Auth0\Middleware; -use Auth0\SDK\Exception\ConfigurationException; -use GuzzleHttp\Exception\GuzzleException; use Auth0\SDK\Exception\ArgumentException; +use Auth0\SDK\Exception\ConfigurationException; use Auth0\SDK\Exception\NetworkException; use Auth0\SDK\Utility\HttpResponse; +use GuzzleHttp\Exception\GuzzleException; +use Lcobucci\JWT\Token\DataSet; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Leuchtfeuer\Auth0\ErrorCode; @@ -29,7 +30,6 @@ use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; use Leuchtfeuer\Auth0\Utility\TokenUtility; use Leuchtfeuer\Auth0\Utility\UserUtility; -use Lcobucci\JWT\Token\DataSet; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; diff --git a/Classes/Service/AuthenticationService.php b/Classes/Service/AuthenticationService.php index 38a77b2e..5122e9f2 100644 --- a/Classes/Service/AuthenticationService.php +++ b/Classes/Service/AuthenticationService.php @@ -18,6 +18,8 @@ use Auth0\SDK\Exception\NetworkException; use Auth0\SDK\Utility\HttpResponse; +use GuzzleHttp\Exception\GuzzleException; +use JsonException; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Leuchtfeuer\Auth0\ErrorCode; use Leuchtfeuer\Auth0\Exception\TokenException; @@ -27,8 +29,6 @@ use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; use Leuchtfeuer\Auth0\Utility\TokenUtility; use Leuchtfeuer\Auth0\Utility\UserUtility; -use GuzzleHttp\Exception\GuzzleException; -use JsonException; use TYPO3\CMS\Core\Authentication\AuthenticationService as BasicAuthenticationService; use TYPO3\CMS\Core\Authentication\LoginType; use TYPO3\CMS\Core\Crypto\PasswordHashing\InvalidPasswordHashException; @@ -186,8 +186,8 @@ protected function initSessionStore(string $loginType): bool { echo 'do not hit'; die(); -// $session = (new SessionFactory())->getSessionStoreForApplication(0, $loginType); -// $userInfo = $session->getUserInfo(); + // $session = (new SessionFactory())->getSessionStoreForApplication(0, $loginType); + // $userInfo = $session->getUserInfo(); // TODO: Check if context needs to be set $userInfo = $this->auth0->configuration()->getSessionStorage()->get('user'); @@ -357,13 +357,13 @@ public function authUser(array $user): int return 100; } -// // Do not login if email address is not verified (only available if API is enabled) -// // TODO:: Support this even API is disabled -// if ($this->auth0User !== null && !$this->auth0User->isEmailVerified()) { -// $this->logger->warning('Email not verified. Do not login user.'); -// // Responsible, authentication failed, do NOT check other services -// return 0; -// } + // // Do not login if email address is not verified (only available if API is enabled) + // // TODO:: Support this even API is disabled + // if ($this->auth0User !== null && !$this->auth0User->isEmailVerified()) { + // $this->logger->warning('Email not verified. Do not login user.'); + // // Responsible, authentication failed, do NOT check other services + // return 0; + // } // Skip when there is an Auth0 session but the corresponding TYPO3 user has no user group assigned. if (empty($user['usergroup']) && $this->loginViaSession === true) { diff --git a/Classes/Service/RedirectService.php b/Classes/Service/RedirectService.php index 718b9ed5..5223adb6 100644 --- a/Classes/Service/RedirectService.php +++ b/Classes/Service/RedirectService.php @@ -24,7 +24,6 @@ use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Felogin\Controller\FrontendLoginController; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; diff --git a/Classes/Utility/ModeUtility.php b/Classes/Utility/ModeUtility.php new file mode 100644 index 00000000..9692f404 --- /dev/null +++ b/Classes/Utility/ModeUtility.php @@ -0,0 +1,38 @@ +, Leuchtfeuer Digital Marketing + */ + +namespace Leuchtfeuer\Auth0\Utility; + +use Psr\Http\Message\ServerRequestInterface; +use TYPO3\CMS\Core\Http\ApplicationType; + +class ModeUtility +{ + public const BACKEND_MODE = 'BE'; + public const FRONTEND_MODE = 'FE'; + + public static function isBackend(?string $mode): bool + { + if (!$mode) { + $mode = self::getModeFromRequest(); + } + + return $mode && $mode === self::BACKEND_MODE; + } + + public static function getModeFromRequest(): string + { + return ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface + && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() + ? self::FRONTEND_MODE + : self::BACKEND_MODE; + } +} diff --git a/Classes/Utility/TokenUtility.php b/Classes/Utility/TokenUtility.php index ad0808dc..80754466 100644 --- a/Classes/Utility/TokenUtility.php +++ b/Classes/Utility/TokenUtility.php @@ -13,10 +13,6 @@ namespace Leuchtfeuer\Auth0\Utility; -use TYPO3\CMS\Core\Http\ApplicationType; -use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; -use Leuchtfeuer\Auth0\Exception\TokenException; -use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; use DateTimeImmutable; use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer; @@ -30,12 +26,14 @@ use Lcobucci\JWT\Validation\Constraint\IssuedBy; use Lcobucci\JWT\Validation\Constraint\PermittedFor; use Lcobucci\JWT\Validation\Constraint\SignedWith; +use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Exception\TokenException; +use Leuchtfeuer\Auth0\Middleware\CallbackMiddleware; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Core\Exception\SiteNotFoundException; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Service\EnvironmentService; class TokenUtility implements LoggerAwareInterface { @@ -157,11 +155,9 @@ public function getToken(): ?Token return $this->token; } - protected function setIssuer(): void + public function setIssuer(?string $mode = null): void { - $environmentService = GeneralUtility::makeInstance(EnvironmentService::class); - - if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { + if (!ModeUtility::isBackend($mode)) { try { $pageId = (int)$GLOBALS['TSFE']->id; $base = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pageId)->getBase(); @@ -176,10 +172,10 @@ protected function setIssuer(): void $this->issuer = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); } $this->withPayload('environment', self::ENVIRONMENT_FRONTEND); - } elseif (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) { - $this->issuer = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); - $this->withPayload('environment', self::ENVIRONMENT_BACKEND); } + + $this->issuer = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); + $this->withPayload('environment', self::ENVIRONMENT_BACKEND); } protected function getSigner(): Signer diff --git a/Classes/Utility/UserUtility.php b/Classes/Utility/UserUtility.php index 10932d89..45ca08e2 100644 --- a/Classes/Utility/UserUtility.php +++ b/Classes/Utility/UserUtility.php @@ -15,11 +15,11 @@ use Auth0\SDK\Auth0; use Auth0\SDK\Utility\HttpResponse; +use GuzzleHttp\Utils; use Leuchtfeuer\Auth0\Domain\Repository\ApplicationRepository; use Leuchtfeuer\Auth0\Domain\Repository\UserRepository; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; use Leuchtfeuer\Auth0\Utility\Database\UpdateUtility; -use GuzzleHttp\Utils; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Backend\Utility\BackendUtility; diff --git a/Resources/Private/Layouts/LoginV12.html b/Resources/Private/Layouts/LoginV12.html new file mode 100644 index 00000000..68727dca --- /dev/null +++ b/Resources/Private/Layouts/LoginV12.html @@ -0,0 +1,140 @@ + + + + diff --git a/Resources/Private/Templates/LoginProvider/BackendV11.html b/Resources/Private/Templates/LoginProvider/BackendV11.html new file mode 100644 index 00000000..6f9e10e5 --- /dev/null +++ b/Resources/Private/Templates/LoginProvider/BackendV11.html @@ -0,0 +1,53 @@ + + + + + + + +
+ {auth0Error} + {auth0ErrorDescription} +
+
+ + +
+ + +
+
+ + + +

+ + {userInfo.nickname} 👋 +

+
+ + +
+
+ +

+ {f:translate(key: 'LLL:EXT:auth0/Resources/Private/Language/locallang_be.xlf:form.not-logged-in') -> f:format.html()} +

+
+ +
+
+
+
+ + + + + +
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/LoginProvider/BackendV12.html b/Resources/Private/Templates/LoginProvider/BackendV12.html new file mode 100644 index 00000000..0b10851d --- /dev/null +++ b/Resources/Private/Templates/LoginProvider/BackendV12.html @@ -0,0 +1,53 @@ + + + + + + + +
+ {auth0Error} + {auth0ErrorDescription} +
+
+ + +
+ + +
+
+ + + +

+ + {userInfo.nickname} 👋 +

+
+ + +
+
+ +

+ {f:translate(key: 'LLL:EXT:auth0/Resources/Private/Language/locallang_be.xlf:form.not-logged-in')} +

+
+ +
+
+
+
+ + + + + +
+
+ \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index 5b193588..0328911c 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,66 +1,69 @@ isEnableFrontendLogin()) { - $subtypes[] = 'authUserFE'; - $subtypes[] = 'getUserFE'; - // Configure Auth0 plugin - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - $extensionKey, - 'LoginForm', - [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'], - [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'] - ); - } +// Load libraries when TYPO3 is not in composer mode +if (\TYPO3\CMS\Core\Core\Environment::isComposerMode() !== true) { + require ExtensionManagementUtility::extPath('auth0') . 'Libraries/vendor/autoload.php'; +} - if ($configuration->isEnableBackendLogin()) { - $subtypes[] = 'getUserBE'; - $subtypes[] = 'authUserBE'; - } +// Load extension configuration +$configuration = new EmAuth0Configuration(); + +// Get proper subtypes for authentication service +$subtypes = []; +if ($configuration->isEnableFrontendLogin()) { + $subtypes[] = 'authUserFE'; + $subtypes[] = 'getUserFE'; - if (!empty($subtypes)) { - // Get priority for Auth0 Authentication Service - $highestPriority = 0; + // Configure Auth0 plugin + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'auth0', + 'LoginForm', + [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'], + [\Leuchtfeuer\Auth0\Controller\LoginController::class => 'form, login, logout'] + ); +} - foreach ($GLOBALS['T3_SERVICES']['auth'] ?? [] as $service) { - if ($service['priority'] > $highestPriority) { - $highestPriority = $service['priority']; - } - } +if ($configuration->isEnableBackendLogin()) { + $subtypes[] = 'getUserBE'; + $subtypes[] = 'authUserBE'; +} - $overrulingPriority = $highestPriority + 10; +if (!empty($subtypes)) { + // Get priority for Auth0 Authentication Service + $highestPriority = 0; - // Register login provider - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService( - $extensionKey, - 'auth', - \Leuchtfeuer\Auth0\Service\AuthenticationService::class, - [ - 'title' => 'Auth0 authentication', - 'description' => 'Authentication with Auth0.', - 'subtype' => implode(',', $subtypes), - 'available' => true, - 'priority' => $overrulingPriority, - 'quality' => $overrulingPriority, - 'os' => '', - 'exec' => '', - 'className' => \Leuchtfeuer\Auth0\Service\AuthenticationService::class - ] - ); + foreach ($GLOBALS['T3_SERVICES']['auth'] ?? [] as $service) { + if ($service['priority'] > $highestPriority) { + $highestPriority = $service['priority']; } - }, 'auth0' -); + } + + $overrulingPriority = $highestPriority + 10; + + // Register login provider + ExtensionManagementUtility::addService( + 'auth0', + 'auth', + AuthenticationService::class, + [ + 'title' => 'Auth0 authentication', + 'description' => 'Authentication with Auth0.', + 'subtype' => implode(',', $subtypes), + 'available' => true, + 'priority' => $overrulingPriority, + 'quality' => $overrulingPriority, + 'os' => '', + 'exec' => '', + 'className' => Leuchtfeuer\Auth0\Service\AuthenticationService::class, + ] + ); +} diff --git a/ext_tables.php b/ext_tables.php index 3af06b8a..d3e3eb07 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,65 +1,71 @@ - '); +// Add content element wizard to PageTSconfig +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(' + +'); - // Register icons - deprecated will move to Configuration/Icons.php in future - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); - $iconRegistry->registerIcon( - 'auth0', - \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - [ - 'source' => 'EXT:auth0/Resources/Public/Icons/auth0.svg', - ] - ); +// Register icons - deprecated will move to Configuration/Icons.php in future +$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); +$iconRegistry->registerIcon( + 'auth0', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + [ + 'source' => 'EXT:auth0/Resources/Public/Icons/auth0.svg', + ] +); - // Load extension configuration - $configuration = new \Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration(); +// Load extension configuration +$configuration = new \Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration(); - if ($configuration->isEnableFrontendLogin()) { - // Register hook for showing plugin preview - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['auth0_loginform'][$extensionKey] - = \Leuchtfeuer\Auth0\Hooks\PageLayoutViewHook::class . '->getSummary'; - } +if ($configuration->isEnableFrontendLogin()) { + // Register hook for showing plugin preview + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['auth0_loginform']['auth0'] + = \Leuchtfeuer\Auth0\Hooks\PageLayoutViewHook::class . '->getSummary'; +} - if ($configuration->isEnableBackendLogin()) { - // Register single log out hooks - // TODO: Support following hooks for frontend request as well and move to ext_localconf.php file - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][$extensionKey] - = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->isResponsible'; - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'][$extensionKey] - = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->performLogout'; +if ($configuration->isEnableBackendLogin()) { + // Register single log out hooks + // TODO: Support following hooks for frontend request as well and move to ext_localconf.php file + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing']['auth0'] + = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->isResponsible'; + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing']['auth0'] + = \Leuchtfeuer\Auth0\Hooks\SingleSignOutHook::class . '->performLogout'; - // Register backend login provider - $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][\Leuchtfeuer\Auth0\LoginProvider\Auth0Provider::LOGIN_PROVIDER] = [ - 'provider' => \Leuchtfeuer\Auth0\LoginProvider\Auth0Provider::class, - 'sorting' => 25, - 'icon-class' => 'fa-sign-in', - 'label' => 'LLL:EXT:auth0/Resources/Private/Language/locallang.xlf:backendLogin.switch.label' - ]; - } - // Register Backend Module - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( - $extensionKey, - 'tools', - 'Auth0', - 'bottom', - [ - \Leuchtfeuer\Auth0\Controller\BackendController::class => 'list', - \Leuchtfeuer\Auth0\Controller\ApplicationController::class => 'list,delete', - \Leuchtfeuer\Auth0\Controller\RoleController::class => 'list,update', - \Leuchtfeuer\Auth0\Controller\PropertyController::class => 'list,new,create,edit,update,delete', - ], [ - 'access' => 'admin', - 'icon' => 'EXT:auth0/Resources/Public/Icons/Module.svg', - 'labels' => 'LLL:EXT:auth0/Resources/Private/Language/locallang_mod.xlf' - ] - ); - }, 'auth0' +} + +// Register Backend Module +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + 'auth0', + 'tools', + 'Auth0', + 'bottom', + [ + BackendController::class => 'list', + ApplicationController::class => 'list,delete', + RoleController::class => 'list,update', + PropertyController::class => 'list,new,create,edit,update,delete', + ], [ + 'access' => 'admin', + 'icon' => 'EXT:auth0/Resources/Public/Icons/Module.svg', + 'labels' => 'LLL:EXT:auth0/Resources/Private/Language/locallang_mod.xlf' + ] ); + +// Register backend login provider +$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][Auth0Provider::LOGIN_PROVIDER] = [ + 'provider' => Auth0Provider::class, + 'sorting' => 25, + 'iconIdentifier' => 'fa-sign-in', + 'label' => 'LLL:EXT:auth0/Resources/Private/Language/locallang.xlf:backendLogin.switch.label' +]; \ No newline at end of file From 2dc713759abfa0952ce2b040e80ef1cc2f4ad3b8 Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 01:53:38 +0200 Subject: [PATCH 05/16] [TASK]Adjust backend module for TYPO3V12 --- Classes/Controller/ApplicationController.php | 17 ++++-- Classes/Controller/BackendController.php | 57 ++++++++++--------- Classes/Controller/PropertyController.php | 36 +++++++----- Classes/Controller/RoleController.php | 6 +- Classes/LoginProvider/Auth0Provider.php | 3 +- Classes/Utility/ModeUtility.php | 7 +++ Classes/Utility/TcaUtility.php | 2 +- Configuration/Backend/Modules.php | 25 ++++++++ Configuration/TypoScript/constants.typoscript | 4 +- 9 files changed, 104 insertions(+), 53 deletions(-) create mode 100644 Configuration/Backend/Modules.php diff --git a/Classes/Controller/ApplicationController.php b/Classes/Controller/ApplicationController.php index 28a42af4..1d89b50b 100644 --- a/Classes/Controller/ApplicationController.php +++ b/Classes/Controller/ApplicationController.php @@ -13,6 +13,7 @@ use Leuchtfeuer\Auth0\Domain\Model\Application; use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; +use Leuchtfeuer\Auth0\Utility\ModeUtility; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Utility\BackendUtility; @@ -26,26 +27,30 @@ class ApplicationController extends BackendController */ public function listAction(): ResponseInterface { + $moduleTemplate = $this->initView(); $pid = $this->getStoragePage(); $this->view->assignMultiple([ 'applications' => $this->applicationRepository->findAll(), 'pid' => $pid, 'directory' => BackendUtility::getRecord('pages', $pid), - 'returnUrl' => $this->getModuleUrl(false), ]); - return $this->htmlResponse(); + if (!ModeUtility::isTYPO3V12()) { + $this->view->assign('returnUrl', $this->getModuleUrl(false)); + } + $moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($moduleTemplate->renderContent()); } /** - * @param Application $application - * * @throws StopActionException */ - public function deleteAction(Application $application): void + public function deleteAction(Application $application): ResponseInterface { $this->applicationRepository->remove($application); $this->addFlashMessage($this->getTranslation('message.application.deleted.text'), $this->getTranslation('message.application.deleted.title')); - $this->redirect('list'); + + return $this->redirect('list'); } protected function getStoragePage(): int diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 4ab0af1f..36e0a5ce 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -16,23 +16,33 @@ use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException; use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder; use TYPO3\CMS\Backend\Template\Components\ButtonBar; +use TYPO3\CMS\Backend\Template\ModuleTemplate; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; -use TYPO3\CMS\Backend\View\BackendTemplateView; use TYPO3\CMS\Core\Imaging\Icon; +use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; class BackendController extends ActionController { protected ApplicationRepository $applicationRepository; - private ModuleTemplateFactory $moduleTemplateFactory; - - public function __construct(ApplicationRepository $applicationRepository, ModuleTemplateFactory $moduleTemplateFactory) - { + protected ModuleTemplateFactory $moduleTemplateFactory; + protected IconFactory $iconFactory; + protected BackendUriBuilder $backendUriBuilder; + + public function __construct( + ApplicationRepository $applicationRepository, + ModuleTemplateFactory $moduleTemplateFactory, + IconFactory $iconFactory, + UriBuilder $uriBuilder, + BackendUriBuilder $backendUriBuilder + ) { $this->applicationRepository = $applicationRepository; $this->moduleTemplateFactory = $moduleTemplateFactory; + $this->iconFactory = $iconFactory; + $this->uriBuilder = $uriBuilder; + $this->backendUriBuilder = $backendUriBuilder; } public function listAction(): ResponseInterface @@ -43,21 +53,17 @@ public function listAction(): ResponseInterface return $this->htmlResponse($moduleTemplate->renderContent()); } - public function initializeView(ViewInterface $view): void + public function initView(): ModuleTemplate { $moduleTemplate = $this->moduleTemplateFactory->create($this->request); - parent::initializeView($view); + $this->createMenu($moduleTemplate); + $this->createButtonBar($moduleTemplate); - if ($this->request->getControllerName() !== 'Backend' && $view instanceof BackendTemplateView) { - $moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); - $this->createMenu(); - $this->createButtonBar(); - } + return $moduleTemplate; } - protected function createMenu(): void + protected function createMenu(ModuleTemplate $moduleTemplate): void { - $moduleTemplate = $this->moduleTemplateFactory->create($this->request); $menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); $menu->setIdentifier('auth0'); @@ -97,27 +103,25 @@ protected function createMenu(): void $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu); } - protected function createButtonBar(): void + protected function createButtonBar(ModuleTemplate $moduleTemplate): void { - $moduleTemplate = $this->moduleTemplateFactory->create($this->request); $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); $listButton = $buttonBar->makeLinkButton() ->setTitle($this->getTranslation('menu.button.overview')) ->setHref($this->getUriBuilder()->reset()->uriFor('list', [], 'Backend')) - ->setIcon($moduleTemplate->getIconFactory()->getIcon('actions-viewmode-tiles', Icon::SIZE_SMALL)); - $buttonBar->addButton($listButton, ButtonBar::BUTTON_POSITION_LEFT); + ->setIcon($this->iconFactory->getIcon('actions-viewmode-tiles', Icon::SIZE_SMALL)); + $buttonBar->addButton($listButton); } - protected function addButton(string $label, string $actionName, string $controllerName, string $icon): void + protected function addButton(string $label, string $actionName, string $controllerName, string $icon, ModuleTemplate $moduleTemplate): void { - $moduleTemplate = $this->moduleTemplateFactory->create($this->request); $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); $linkButton = $buttonBar->makeLinkButton() ->setTitle($this->getTranslation($label)) ->setHref($this->getUriBuilder()->reset()->uriFor($actionName, [], $controllerName)) - ->setIcon($moduleTemplate->getIconFactory()->getIcon($icon, Icon::SIZE_SMALL)); + ->setIcon($this->iconFactory->getIcon($icon, Icon::SIZE_SMALL)); $buttonBar->addButton($linkButton, ButtonBar::BUTTON_POSITION_RIGHT); } @@ -127,8 +131,6 @@ protected function addButton(string $label, string $actionName, string $controll */ protected function getModuleUrl(bool $encoded = true, string $referenceType = BackendUriBuilder::ABSOLUTE_PATH): string { - $backendUriBuilder = $this->objectManager->get(BackendUriBuilder::class); - $parameters = [ 'tx_auth0_tools_auth0auth0' => [ 'action' => $this->request->getControllerActionName(), @@ -136,17 +138,16 @@ protected function getModuleUrl(bool $encoded = true, string $referenceType = Ba ], ]; - $uri = $backendUriBuilder->buildUriFromRoute('tools_Auth0Auth0', $parameters, $referenceType); + $uri = $this->backendUriBuilder->buildUriFromRoute('tools_Auth0Auth0', $parameters, $referenceType); return $encoded ? rawurlencode($uri) : $uri; } protected function getUriBuilder(): UriBuilder { - $uriBuilder = $this->objectManager->get(UriBuilder::class); - $uriBuilder->setRequest($this->request); + $this->uriBuilder->setRequest($this->request); - return $uriBuilder; + return $this->uriBuilder; } protected function getTranslation($key): string diff --git a/Classes/Controller/PropertyController.php b/Classes/Controller/PropertyController.php index 67ae8bd5..5c80d3e4 100644 --- a/Classes/Controller/PropertyController.php +++ b/Classes/Controller/PropertyController.php @@ -25,31 +25,36 @@ class PropertyController extends BackendController public function listAction(): ResponseInterface { $tcaUtility = new TcaUtility(); - + $moduleTemplate = $this->initView(); $this->view->assignMultiple([ 'frontendUserColumns' => $tcaUtility->getColumnsFromTable('fe_users'), 'backendUserColumns' => $tcaUtility->getColumnsFromTable('be_users'), 'extensionConfiguration' => new EmAuth0Configuration(), 'yamlConfiguration' => GeneralUtility::makeInstance(Auth0Configuration::class)->load(), ]); - return $this->htmlResponse(); + $moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($moduleTemplate->renderContent()); } public function newAction(string $table, string $type): ResponseInterface { - $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close'); + $moduleTemplate = $this->initView(); + $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close', $moduleTemplate); $this->view->assignMultiple([ 'table' => $table, 'type' => $type, 'properties' => (new TcaUtility())->getUnusedColumnsFromTable($table), ]); - return $this->htmlResponse(); + $moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($moduleTemplate->renderContent()); } /** * @throws StopActionException */ - public function createAction(array $property, string $table, string $type) + public function createAction(array $property, string $table, string $type): ResponseInterface { if (empty($property['databaseField']) || empty($property['auth0Property'])) { return new ForwardResponse('new'); @@ -61,15 +66,15 @@ public function createAction(array $property, string $table, string $type) $configuration = $auth0Configuration->load(); $configuration['properties'][$table][$type][] = $propertyConfiguration; $auth0Configuration->write($configuration); - $this->addFlashMessage($this->getTranslation('message.property.created.text'), $this->getTranslation('message.property.created.title')); - $this->redirect('list'); + + return $this->redirect('list'); } /** * @throws StopActionException */ - public function deleteAction(array $property, string $table, string $type): void + public function deleteAction(array $property, string $table, string $type): ResponseInterface { if ((bool)$property['readOnly'] === false) { $auth0Configuration = GeneralUtility::makeInstance(Auth0Configuration::class); @@ -86,25 +91,29 @@ public function deleteAction(array $property, string $table, string $type): void } $this->addFlashMessage($this->getTranslation('message.property.deleted.text'), $this->getTranslation('message.property.deleted.title')); - $this->redirect('list'); + + return $this->redirect('list'); } public function editAction(array $property, string $table, string $type): ResponseInterface { - $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close'); + $moduleTemplate = $this->initView(); + $this->addButton('menu.button.cancel', 'list', 'Property', 'actions-close', $moduleTemplate); $this->view->assignMultiple([ 'property' => $property, 'table' => $table, 'type' => $type, 'properties' => (new TcaUtility())->getUnusedColumnsFromTable($table, $property['databaseField']), ]); - return $this->htmlResponse(); + $moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($moduleTemplate->renderContent()); } /** * @throws StopActionException */ - public function updateAction(array $property, string $table, string $type): void + public function updateAction(array $property, string $table, string $type): ResponseInterface { $auth0Configuration = GeneralUtility::makeInstance(Auth0Configuration::class); $configuration = $auth0Configuration->load(); @@ -118,6 +127,7 @@ public function updateAction(array $property, string $table, string $type): void $auth0Configuration->write($configuration); $this->addFlashMessage($this->getTranslation('message.property.updated.text'), $this->getTranslation('message.property.updated.title')); - $this->redirect('list'); + + return $this->redirect('list'); } } diff --git a/Classes/Controller/RoleController.php b/Classes/Controller/RoleController.php index f47ce7a0..60874fcd 100644 --- a/Classes/Controller/RoleController.php +++ b/Classes/Controller/RoleController.php @@ -23,13 +23,16 @@ class RoleController extends BackendController { public function listAction(): ResponseInterface { + $moduleTemplate = $this->initView(); $this->view->assignMultiple([ 'frontendUserGroupMapping' => (new FrontendUserGroupRepository())->findAll(), 'backendUserGroupMapping' => (new BackendUserGroupRepository())->findAll(), 'extensionConfiguration' => new EmAuth0Configuration(), 'yamlConfiguration' => GeneralUtility::makeInstance(Auth0Configuration::class)->load(), ]); - return $this->htmlResponse(); + $moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($moduleTemplate->renderContent()); } /** @@ -58,6 +61,7 @@ public function updateAction( $auth0Configuration->write($configuration); $this->addFlashMessage($this->getTranslation('message.role.updated.text'), $this->getTranslation('message.role.updated.title')); + return $this->redirect('list'); } } diff --git a/Classes/LoginProvider/Auth0Provider.php b/Classes/LoginProvider/Auth0Provider.php index 7c16e5e9..b51d52ec 100644 --- a/Classes/LoginProvider/Auth0Provider.php +++ b/Classes/LoginProvider/Auth0Provider.php @@ -27,7 +27,6 @@ use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Backend\Controller\LoginController; use TYPO3\CMS\Backend\LoginProvider\LoginProviderInterface; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -216,7 +215,7 @@ protected function logoutFromAuth0(): void private function getTemplateName(): string { - $templateName = version_compare(GeneralUtility::makeInstance(Typo3Version::class)->getVersion(), '12.0', '>=') ? 'BackendV12' : 'BackendV11'; + $templateName = ModeUtility::isTYPO3V12() ? 'BackendV12' : 'BackendV11'; return 'LoginProvider/' . $templateName; } diff --git a/Classes/Utility/ModeUtility.php b/Classes/Utility/ModeUtility.php index 9692f404..b3e9049e 100644 --- a/Classes/Utility/ModeUtility.php +++ b/Classes/Utility/ModeUtility.php @@ -13,6 +13,8 @@ use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Http\ApplicationType; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\GeneralUtility; class ModeUtility { @@ -35,4 +37,9 @@ public static function getModeFromRequest(): string ? self::FRONTEND_MODE : self::BACKEND_MODE; } + + public static function isTYPO3V12(): bool + { + return version_compare(GeneralUtility::makeInstance(Typo3Version::class)->getVersion(), '12.0', '>='); + } } diff --git a/Classes/Utility/TcaUtility.php b/Classes/Utility/TcaUtility.php index a11229e2..63ce64c6 100644 --- a/Classes/Utility/TcaUtility.php +++ b/Classes/Utility/TcaUtility.php @@ -45,7 +45,7 @@ public function getColumnsFromTable(string $tableName): array if ($type === 'select') { $columns[$name]['items'] = []; foreach ($column['config']['items'] ?? [] as $item) { - $columns[$name]['items'][$item[1]] = $GLOBALS['LANG']->sl($item[0]); + $columns[$name]['items'][$item[1] ?? $item['value']] = $GLOBALS['LANG']->sl($item[0] ?? $item['label']); } } } diff --git a/Configuration/Backend/Modules.php b/Configuration/Backend/Modules.php new file mode 100644 index 00000000..e479d5a0 --- /dev/null +++ b/Configuration/Backend/Modules.php @@ -0,0 +1,25 @@ + [ + 'parent' => 'system', + 'position' => ['after' => 'web_info'], + 'access' => 'admin', + 'workspaces' => 'live', + 'iconIdentifier' => 'EXT:auth0/Resources/Public/Icons/Module.svg', + 'path' => '/module/system/auth0', + 'labels' => 'LLL:EXT:auth0/Resources/Private/Language/locallang_mod.xlf', + 'extensionName' => 'auth0', + 'controllerActions' => [ + BackendController::class => 'list', + ApplicationController::class => 'list,delete', + RoleController::class => 'list,update', + PropertyController::class => 'list,new,create,edit,update,delete', + ], + ], +]; \ No newline at end of file diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index be6bd06d..9b59dfb4 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -6,7 +6,7 @@ plugin.tx_auth0 { } persistence { - storagePid = + storagePid = 94 } } @@ -15,6 +15,6 @@ module.tx_auth0 { templateRootPath = EXT:auth0/Resources/Private/Templates/ layoutRootPath = EXT:auth0/Resources/Private/Layouts/ } - persistence.storagePid = 1 + persistence.storagePid = 94 settings.stylesheet = EXT:auth0/Resources/Public/Styles/backend.css } From 74d52be30c1473ebeef7ed05ff3d8af0b0dbdd4f Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 06:44:45 +0200 Subject: [PATCH 06/16] [TASK]Adjust backend module icon --- Configuration/Backend/Modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Backend/Modules.php b/Configuration/Backend/Modules.php index e479d5a0..d131b185 100644 --- a/Configuration/Backend/Modules.php +++ b/Configuration/Backend/Modules.php @@ -11,7 +11,7 @@ 'position' => ['after' => 'web_info'], 'access' => 'admin', 'workspaces' => 'live', - 'iconIdentifier' => 'EXT:auth0/Resources/Public/Icons/Module.svg', + 'iconIdentifier' => 'auth0', 'path' => '/module/system/auth0', 'labels' => 'LLL:EXT:auth0/Resources/Private/Language/locallang_mod.xlf', 'extensionName' => 'auth0', From 50f9cdf214d6efe125f29398989ba16bef92fca9 Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 07:01:03 +0200 Subject: [PATCH 07/16] [BUGFIX]Fix field naming in property form --- Resources/Private/Partials/Backend/Property/Form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/Partials/Backend/Property/Form.html b/Resources/Private/Partials/Backend/Property/Form.html index 33d24c4f..406d38b6 100644 --- a/Resources/Private/Partials/Backend/Property/Form.html +++ b/Resources/Private/Partials/Backend/Property/Form.html @@ -9,7 +9,7 @@ - From 9f8f06f6eb7f0d592581c04f48b17aa8f498c64f Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 07:12:46 +0200 Subject: [PATCH 08/16] [TASK]Adjust backend module icon --- Configuration/Backend/Modules.php | 2 +- ext_tables.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Configuration/Backend/Modules.php b/Configuration/Backend/Modules.php index d131b185..e26c9d49 100644 --- a/Configuration/Backend/Modules.php +++ b/Configuration/Backend/Modules.php @@ -11,7 +11,7 @@ 'position' => ['after' => 'web_info'], 'access' => 'admin', 'workspaces' => 'live', - 'iconIdentifier' => 'auth0', + 'iconIdentifier' => 'moduleAuth0', 'path' => '/module/system/auth0', 'labels' => 'LLL:EXT:auth0/Resources/Private/Language/locallang_mod.xlf', 'extensionName' => 'auth0', diff --git a/ext_tables.php b/ext_tables.php index d3e3eb07..f426cc1a 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -23,6 +23,13 @@ 'source' => 'EXT:auth0/Resources/Public/Icons/auth0.svg', ] ); +$iconRegistry->registerIcon( + 'moduleAuth0', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + [ + 'source' => 'EXT:auth0/Resources/Public/Icons/Module.svg', + ] +); // Load extension configuration $configuration = new \Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration(); From 241f0db4078f7c20e8c0a6e28931ea4beddefb4f Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 07:25:13 +0200 Subject: [PATCH 09/16] [BUGFIX]Fix field naming in property form --- Resources/Private/Partials/Backend/Property/Form.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/Private/Partials/Backend/Property/Form.html b/Resources/Private/Partials/Backend/Property/Form.html index 406d38b6..40a88c85 100644 --- a/Resources/Private/Partials/Backend/Property/Form.html +++ b/Resources/Private/Partials/Backend/Property/Form.html @@ -9,7 +9,7 @@ - +
From 1a1e81134e6476043b88f8bb2497b7f525754fae Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 8 Sep 2023 09:50:00 +0200 Subject: [PATCH 10/16] [TASK]Remove unused files --- Resources/Private/Templates/Backend.html | 55 --------------------- Resources/Private/Templates/BackendV11.html | 53 -------------------- 2 files changed, 108 deletions(-) delete mode 100644 Resources/Private/Templates/Backend.html delete mode 100644 Resources/Private/Templates/BackendV11.html diff --git a/Resources/Private/Templates/Backend.html b/Resources/Private/Templates/Backend.html deleted file mode 100644 index 0b4e6211..00000000 --- a/Resources/Private/Templates/Backend.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - -
- {auth0Error} - {auth0ErrorDescription} -
-
- - -
- - -
-
- - - -

- - {userInfo.nickname} 👋 -

-
- - -
-
- -

- {f:translate(key: 'LLL:EXT:auth0/Resources/Private/Language/locallang_be.xlf:form.not-logged-in') -> f:format.html()} -

-
- -
-
-
-
- - - - - -
-
- \ No newline at end of file diff --git a/Resources/Private/Templates/BackendV11.html b/Resources/Private/Templates/BackendV11.html deleted file mode 100644 index 6f9e10e5..00000000 --- a/Resources/Private/Templates/BackendV11.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - -
- {auth0Error} - {auth0ErrorDescription} -
-
- - -
- - -
-
- - - -

- - {userInfo.nickname} 👋 -

-
- - -
-
- -

- {f:translate(key: 'LLL:EXT:auth0/Resources/Private/Language/locallang_be.xlf:form.not-logged-in') -> f:format.html()} -

-
- -
-
-
-
- - - - - -
-
- \ No newline at end of file From 3ca69b8af9d1de156cb50170ff7c405a8172486c Mon Sep 17 00:00:00 2001 From: abid Date: Mon, 11 Sep 2023 01:53:34 +0200 Subject: [PATCH 11/16] [TASK]Add documentation for version 5.0 --- Documentation/About/Changelog/5-0-0.rst | 47 +++++++++++++++++++++++++ README.md | 17 ++++----- ext_emconf.php | 4 +-- 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 Documentation/About/Changelog/5-0-0.rst diff --git a/Documentation/About/Changelog/5-0-0.rst b/Documentation/About/Changelog/5-0-0.rst new file mode 100644 index 00000000..d5baf040 --- /dev/null +++ b/Documentation/About/Changelog/5-0-0.rst @@ -0,0 +1,47 @@ +.. include:: ../../Includes.txt + +========================== +Version 5.0.0 - 2023/09/11 +========================== + +This release is a major release, which will likely be breaking. Please be careful when upgrading to this version the namespace is changed from Bitmotion into Leuchtfeuer. +It introduces TYPO3 12.4 Support as well as support for PHP 7.4+. +We first concentrated on the functionality of the backend login with the help of Auth0 and refactored and restructured +most of it. + +Download +======== + +Download this version from the `TYPO3 extension repository `__ or from +`GitHub `__. + +Added +===== + +* Support for TYPO3 v12.4 + +Deprecated +========== + +Removed +======= + +* Support for TYPO3 v10 + +All Changes +=========== + +This is a list of all changes in this release:: + + 2023-09-08 [TASK]Remove unused files (Commit 1a1e811 by Yassine Abid) + 2023-09-08 [BUGFIX]Fix field naming in property form (Commit 241f0db by Yassine Abid) + 2023-09-08 [TASK]Adjust backend module icon (Commit 9f8f06f by Yassine Abid) + 2023-09-08 [BUGFIX]Fix field naming in property form (Commit 50f9cdf by Yassine Abid) + 2023-09-08 [TASK]Adjust backend module icon (Commit 74d52be by Yassine Abid) + 2023-09-08 [TASK]Adjust backend module for TYPO3V12 (Commit 2dc7137 by Yassine Abid) + 2023-09-07 [TASK]Backend login for 12 and remove support for 10 (Commit e8c641d by Yassine Abid) + 2023-09-07 [TASK]Remove Bitmotion as namespace (Commit 182928c by Yassine Abid) + 2023-09-06 [TASK]Process ext with rector for typo3 v11 and php74 (Commit fdb1685 by Yassine Abid) + 2023-09-06 [TASK]Make required libraries compatible for TYPO3 12; Require rector for dev environement (Commit 266ac14 by Yassine Abid) + +s \ No newline at end of file diff --git a/README.md b/README.md index 5cdd1fb1..fe020eff 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,15 @@ The full documentation for the latest releases can be found [here](https://docs. You need access to an [Auth0](https://auth0.com/) instance. We are currently supporting following TYPO3 versions:

-| Extension Version | TYPO3 v11 Support | TYPO3 v10 Support | TYPO3 v9 Support | TYPO3 v8 Support | -| :-: | :-: | :-: | :-: | :-: | -| 4.x | x | x | - | - | -| 3.x | - | x | x | | -| 2.x | - | - | x | | -| 1.x | - | - | - | x | - -_Alpha support for TYPO3 v11.5 is available since version 4.0.0-alpha._ +| Extension Version | TYPO3 v12 Support | TYPO3 v11 Support | TYPO3 v10 Support | TYPO3 v9 Support | TYPO3 v8 Support | +|:-----------------:|:-----------------:|:-----------------:|:-----------------:|:----------------:|:----------------:| +| 5.x | x | x | - | - | - | +| 4.x | - | x | x | - | - | +| 3.x | - | - | x | x | | +| 2.x | - | - | - | x | | +| 1.x | - | - | - | - | x | + +_Alpha support for TYPO3 v12.4 is available since version 5.0.0-alpha._ ## About Auth0 Auth0 helps you to: diff --git a/ext_emconf.php b/ext_emconf.php index 0a60b8e7..69dbba39 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -13,8 +13,8 @@ 'suggests' => [], ], 'state' => 'stable', - 'author' => 'Max Rösch', - 'author_email' => 'm.roesch@Leuchtfeuer.com', + 'author' => 'Dev Leuchtfeuer', + 'author_email' => 'dev@Leuchtfeuer.com', 'author_company' => 'Leuchtfeuer Digital Marketing', 'autoload' => [ 'psr-4' => [ From 3b9a43cc997d9f6b92881247fe68325ecae6b9a7 Mon Sep 17 00:00:00 2001 From: abid Date: Wed, 13 Sep 2023 13:30:30 +0200 Subject: [PATCH 12/16] [TASK]Revert test typo configs --- Configuration/TypoScript/constants.typoscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 9b59dfb4..be6bd06d 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -6,7 +6,7 @@ plugin.tx_auth0 { } persistence { - storagePid = 94 + storagePid = } } @@ -15,6 +15,6 @@ module.tx_auth0 { templateRootPath = EXT:auth0/Resources/Private/Templates/ layoutRootPath = EXT:auth0/Resources/Private/Layouts/ } - persistence.storagePid = 94 + persistence.storagePid = 1 settings.stylesheet = EXT:auth0/Resources/Public/Styles/backend.css } From 290d3dcb3242b21d91fdc980acf95a8a27f3b806 Mon Sep 17 00:00:00 2001 From: abid Date: Fri, 15 Sep 2023 08:51:43 +0200 Subject: [PATCH 13/16] [BUGFIX]Fix auth0 authentication service declaration --- ext_localconf.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 0328911c..60cf19ec 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Leuchtfeuer\Auth0\Domain\Transfer\EmAuth0Configuration; -use TYPO3\CMS\Core\Authentication\AuthenticationService; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') || die(''); @@ -53,7 +52,7 @@ ExtensionManagementUtility::addService( 'auth0', 'auth', - AuthenticationService::class, + Leuchtfeuer\Auth0\Service\AuthenticationService::class, [ 'title' => 'Auth0 authentication', 'description' => 'Authentication with Auth0.', From cbbdb3957465c95a5f13a342509ee4975801282d Mon Sep 17 00:00:00 2001 From: abid Date: Sun, 17 Sep 2023 18:14:53 +0200 Subject: [PATCH 14/16] [BUGFIX]Style login provider --- Resources/Private/Layouts/LoginV12.html | 3 +-- Resources/Public/Icons/sign-in.svg | 5 +++++ Resources/Public/Styles/backend.css | 12 ++++++++++++ ext_tables.php | 9 ++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 Resources/Public/Icons/sign-in.svg diff --git a/Resources/Private/Layouts/LoginV12.html b/Resources/Private/Layouts/LoginV12.html index 68727dca..3d37a269 100644 --- a/Resources/Private/Layouts/LoginV12.html +++ b/Resources/Private/Layouts/LoginV12.html @@ -4,13 +4,12 @@ data-namespace-typo3-fluid="true" > -