BeSimple/BeSimpleSsoAuthBundle — Issue #15: use of is_granted with twig
Author: artturi
Created: 2012-03-09 11:09:08+00:00
State: open

Hello,

I'm not absolutely sure this is related to BeSimpleSsoAuthBundle, but I suspect it is :

In my twig template, I call this in the footer :

{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
some text
{% endif %}

I have 2 firewalls :

- one using this bundle
- one using FosUserBundle's

The call to is_granted works well when accessing a page controlled by FosUserBundle's firewall. But when trying on the other firewall, I get this error :

Fatal error: Maximum function nesting level of '500' reached, aborting!

And in symfony's dev.log file, I get a lot of these :

[2012-03-09 11:07:46] security.INFO: Authentication exception occurred; redirecting to authentication entry point (The security context contains no authentication token. One possible reason may be that there is no firewall configured for this URL.) [] []
[2012-03-09 11:07:46] security.DEBUG: Calling Authentication entry point [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onEarlyKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
[2012-03-09 11:07:46] event.DEBUG: Notified event "kernel.controller" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener::onCoreController". [] []

Do you think it's a problem with BeSimpleSsoAuthBundle ?
And do you have any idea about how to deal with that ?

Thanks in advance
Regards