[SOLVED] Setting up custom UserService

I have some Problems with using my own UserService instead of the standard Neos one. I have configured the settings.yaml like this in my site package:

        userInformation: 'Vendor\Package\Service\UserService'

after i run the

./flow configuration:show --type Settings --path Neos.Flow.aop

i got the correct result, that the UserService has been set, but when i try to login into the Backend the default Neos UserService will be used.

Depending on the FLOW_CONTEXT you will have to run ./flow flow:cache:flush --force to clear the build AOP cache

No that doesn’t work either, I am in the Development Context. After clearing the cache the UserService is still the default one.

Make sure that the dependency order is correct and you Settings.yaml is not loaded after the Neos.Neos package.

The whole AOP and userService is fairly cached, so try and manually remove all files from Data/Temporary/Cache just to be sure it is all rebuild

when i run the

./flow configuration:show --type Settings --path Neos.Flow.aop

command it shows me that the correct UserService is set. For Testing purposes i also changed it in the Neos.Neos Package but it was still the default one set.

I cleared the cache multiple time with:

rm -rf Data/Temporary/*

My Class looks like this:

    namespace Vendor\Package\Service;

    use Neos\Flow\Annotations as Flow;
    use Neos\Neos\Domain\Model\User;
    use Neos\ContentRepository\Domain\Model\Workspace;
    use Neos\ContentRepository\Domain\Repository\WorkspaceRepository;
    use Neos\Neos\Utility\User as UserUtility;
    use Neos\Flow\Security\Policy\Role;
    use Neos\Flow\Security\Context;
    use Neos\Neos\Service\UserService as BaseUserService;

     * The user service provides general context information about the currently
     * authenticated backend user.
     * The methods getters of this class are accessible via the "context.userInformation" variable in security policies
     * and thus are implicitly considered to be part of the public API. This UserService should be replaced by
     * \Neos\Neos\Domain\Service\UserService in the long run.
     * @Flow\Scope("singleton")
     * @api
    class UserService extends BaseUserService

         * @var \Neos\Flow\Persistence\PersistenceManagerInterface
         * @Flow\Inject
        protected $persistenceManager;

         * Returns the current backend user
         * @return User
         * @api
        public function getBackendUser()
            if ($this->securityContext->canBeInitialized() === true) {
                $account = $this->securityContext->getAccount();
                if ($account !== null) {
                    return $this->userDomainService->getUser($account->getAccountIdentifier());

            return null;

ok i figured it out myself, i had to implement the CacheAwareInterface.