neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

(Injected) Dependency to TYPO3CR\Domain\Service\ContextFactory in TypeConverter silently breaks authentication

Open neos-bot opened this issue 9 years ago • 1 comments

Jira issue originally created by user @grebaldi:

Steps to reproduce:

  • In a project with enabled security (PresistedUsernameAndPasswordProvider) and dependency to TYPO3CR write a TypeConverter with direct or transitive dependency to TYPO3CR\Domain\Service\ContextFactory
  • Given Authentication worked before, it will now fail silently, with a status of NO_CREDENTIALS_GIVEN

Investigation so far:

  • The action request never receives the authentication parameters, because \TYPO3\Flow\MVC\DispatchComponent::mergeArguments doesn't get executed completely
  • It fails silently at line 113, when the dependency proxy of the property mapper gets resolved
  • You can track down the problem to the constructor call of the TypeConverter in the ObjectManager, so I guess something weird happens, when the dependency to TYPO3CR\Domain\Service\ContextFactory gets resolved
  • Some more logging shows, that the ContextFactory actually gets resolved and the exeution merely stops at resolving the ContentDimensionRepository
  • No exception ever shows up or is logged, but at some point one definitely is thrown, but I haven't found it yet...

Workaround:

You can easily work around this, by resolving the dependency explicitly via ObjectManager inside your TypeConverter as per http://flowframework.readthedocs.org/en/stable/TheDefinitiveGuide/PartIII/ObjectManagement.html#retrieving-singletons (below the note)

Jira-URL: https://jira.neos.io/browse/NEOS-1456

neos-bot avatar Jul 28 '15 00:07 neos-bot

Comment created by @kitsunet:

I guess a proper fix would be to not instanciate all existing TypeConverters when the PropertyMapper is initialized as that happens so early already.

Something in the lines of https://review.typo3.org/#/c/39570 but CompileStatic only works for production context...

neos-bot avatar Jul 28 '15 09:07 neos-bot