eZ Community » Forums » eZ Publish 5 Platform » SecurityContex, help needed to...
expandshrink

SecurityContex, help needed to understand it

SecurityContex, help needed to understand it

Saturday 11 May 2013 5:38:22 pm - 5 replies

Hi all,

I have a big problem with existing installation of ez 2013.04 and ez5.

My situation is this. I have managed to upgrade existing ez installation from 2012.08 to latest 2013.04 (ezpublish_community). If I use ezpublish_community location as my root installation (without symfony2 stack) everything is fine. I can login to my frontend and backend without a problem.

Problem starts when using symfony2 stack. I can't see frontend the error I see is  "A Token was not found in the SecurityContext." In output log I see this: "DEBUG - Trying to pre-authenticate user "-1"
INFO - Cleared security context due to exception: Could not find 'Content' with identifier 'array ( 'id' => 10, 'languages' => NULL, 'versionNo' => 2, )' "

Can someone please help me understand why on legacy everything is working but not on ezpublish5.

As I understand database is the same, users table is the same. Where can I look for SecurityContex logic in kernel? Where? I would like to understand "black voodoo magic" behind it.

Any tips where to look?

S. 

Saturday 11 May 2013 5:51:26 pm

Hi Siniša

This is a bug that has been fixed last week (the commit is here) and it was due to a wrong lazy loading. Actually the issue does not come from the Security Context (this is actually a consequence), but from the legacy IOHandler.

So you can either update to the latest ezpublish-kernel dev (you can do that with a composer update) or wait for 2013.5 happy.gif Emoticon.

Cheers !

Saturday 11 May 2013 8:56:33 pm

Quote from Jérôme Vieilledent :

Hi Siniša

This is a bug that has been fixed last week (the commit is here) and it was due to a wrong lazy loading. Actually the issue does not come from the Security Context (this is actually a consequence), but from the legacy IOHandler.

So you can either update to the latest ezpublish-kernel dev (you can do that with a composer update) or wait for 2013.5 happy.gif Emoticon.

Cheers !

Hi Jérôme,

thanx for helping me, much appreciate. After pulling latest ezpublish-kernel repo I still have that error.

DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\RequestEventListener:omg.gif EmoticonnKernelRequestSetup". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "eZ\Publish\Core\MVC\Symfony\EventListener\SiteAccessMatchListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener:omg.gif EmoticonnKernelRequest". 
INFO - Router eZ\Bundle\EzPublishCoreBundle\Routing\DefaultRouter was not able to match, message "" 
INFO - Router eZ\Bundle\EzPublishCoreBundle\Routing\UrlAliasRouter was not able to match, message "Config says to bypass UrlAliasRouter" 
INFO - Matched route "ez_legacy" (parameters: "_route": "ez_legacy", "_controller": "ezpublish_legacy.controller:indexAction"blunk.gif Emoticon 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\LocaleListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\RequestEventListener:omg.gif EmoticonnKernelRequestForward". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall:omg.gif EmoticonnKernelRequest". 
DEBUG - Checking secure context token: 
DEBUG - Trying to pre-authenticate user "-1" 
INFO - Cleared security context due to exception: Could not find 'Content' with identifier 'array ( 'id' => 10, 'languages' => NULL, 'versionNo' => 2, )' 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener:omg.gif EmoticonnKernelException". 
INFO - Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.) 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener:omg.gif EmoticonnKernelException". 
DEBUG - Notified event "kernel.exception" to listener "eZ\Bundle\EzPublishRestBundle\EventListener\RestListener:omg.gif EmoticonnKernelExceptionView". 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener:omg.gif EmoticonnKernelException". 
CRITICAL - Uncaught PHP Exception Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException: "A Token was not found in the SecurityContext." at /var/www/www2.embrioproduction.com/public_html/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php line 56 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\RequestEventListener:omg.gif EmoticonnKernelRequestSetup". DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Publish\Core\MVC\Symfony\EventListener\SiteAccessMatchListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\LocaleListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\RequestEventListener:omg.gif EmoticonnKernelRequestForward". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener:omg.gif EmoticonnKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\Fragment\FragmentHandler:omg.gif EmoticonnKernelRequest".
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener::injectLogger". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishCoreBundle\EventListener\RequestEventListener:omg.gif EmoticonnKernelRequestRedirect". 
DEBUG - Notified event "kernel.request" to listener "closure". 
DEBUG - Notified event "kernel.request" to listener "eZ\Bundle\EzPublishRestBundle\EventListener\RestListener:omg.gif EmoticonnKernelRequest".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector:omg.gif EmoticonnKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector:omg.gif EmoticonnKernelController".

 

Still can't figure out what is wrong and where is the source of problem.

Any hint or direction to look further? Please.

Best regards,

Sinisa

Sunday 12 May 2013 3:39:51 pm

Can you please tell me what version of ezpublish-kernel your main composer.json is pointing to ?

Wednesday 15 May 2013 1:09:38 am

Quote from Jérôme Vieilledent :

Can you please tell me what version of ezpublish-kernel your main composer.json is pointing to ?

Hi,

on php compocer.phar update I can see this:

   - Updating ezsystems/ezpublish-kernel dev-master (b426237 => e070f59)
<span>Checking out e070f596b9d72aa8dd9274891b3bcded902168f8</span>

In composer.json is line with "ezsystems/ezpublish-kernel": "5.1.*@dev",

I have even removed vendor folder and run install again but the same result, error.

What else can I do? Btw on symfony2 debug toolbar I don't see Anonymous user logged in ("You are not Authenticated."blunk.gif Emoticon 

Best regards,
S. 

Modified on Wednesday 15 May 2013 1:10:14 am by Siniša Šehović

Thursday 23 May 2013 10:12:46 pm

Hi Jérôme, 

I have found what went wrong with my installation. Thanks to this post http://share.ez.no/forums/ez-publish-5-platform/developing-fieldtype-with-parameters and with your little push to right direction.

Main problem was in User class with additional recaptcha attribute. Because ez5 does not have that fieldType and because of that, anonymous user was not authenticated.

Puff, pant, piff, after 2 weeks of investigation happy.gif Emoticon

Now let's dig deeper into ez5 and symfony2.

S. 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from