Project

General

Profile

Actions

Bug #99131

closed

Cannot use repository methods in Authentication service 11.5 anymore

Added by Jacco van der Post over 1 year ago. Updated about 2 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Authentication
Target version:
-
Start date:
2022-11-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I am upgrading from 9.5 to 11.5 an AuthenticationService class with getUser() for frontend login

When I try to use a repository to add or update some objects I get

The controller "Login" is not allowed by plugin "Login". Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

When debugging the Repository methods work fine and the objects are updated in the database. I am now forced to use queryBuilder which is not very easy for updating sys_refindex relations.

Actions #1

Updated by Christian Kuhn over 1 year ago

  • Status changed from New to Needs Feedback

Hey. Thanks for your report.

Your description is a bit hard to understand and follow, I don't understand what is going on.
Could you add some code, including your service registration and a stripped down implementation that can be used to trigger your issue?

Actions #2

Updated by Jacco van der Post over 1 year ago

Hey Christian,

See here a simple code example of AuthenticationService.php.

<?php

namespace Xxx\Xxxauth\Service;

use Xxx\Xxxauth\Domain\Repository\BankaccountRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class AuthenticationService extends \TYPO3\CMS\Core\Authentication\AuthenticationService
{

// We cannot use construct here:
// Too few arguments to function Xxx\Xxxauth\Service\AuthenticationService::__construct(), 0 passed in /Users/jaccovanderpost/Sites/Xxxned.test/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3221 and exactly 1 expected

//    protected BankaccountRepository $bankaccountRepository;
//
//    public function __construct(
//        BankaccountRepository $bankaccountRepository
//    )
//    {
//        $this->bankaccountRepository = $bankaccountRepository;
//    }

    public function getUser()
    {
        $bankaccountRepository = GeneralUtility::makeInstance(BankaccountRepository::class);

        $test = $bankaccountRepository->findByUid(1);

        // DebuggerUtility::var_dump($test);

        // exit();
    }
}

This results in the fe_login error mentioned above. When removing the repository lines or using QueryBuilder instead, the login process continues and the user is logged in. When removing the comments before var_dump the output is correct.

In 9.5 it was no problem to use repositories in an AuthenticationService.

In ext_localconf.php:

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService(
        'xxxauth',
        'auth',
        \Xxx\Xxxauth\Service\AuthenticationService::class,
        [
            'title' => 'Authentication service',
            'description' => 'Authentication Lookup at XxxWorldWide',
            'subtype' => 'getUserFE, authUserFE, getGroupsFE',
            'available' => true,
            'priority' => 90,
            'quality' => 90,
            'os' => '',
            'exec' => '',
            'className' => \Xxx\Xxxauth\Service\AuthenticationService::class
        ]
    );
Actions #3

Updated by Georg Ringer about 2 months ago

  • Status changed from Needs Feedback to Rejected

hey!

thanks for the detailed report. I am closing this as won't fix. using repositories from extbase is not what you should do at this point of time. please use the querybuilder as you already tested it.

Actions

Also available in: Atom PDF