<p dir="auto">I'm using Symfony 2.3 and written something very similar to this cookbook entry (<a href="http://symfony.com/doc/2.3/cookbook/security/voters.html" rel="nofollow">http://symfony.com/doc/2.3/cookbook/security/voters.html</a>). I think my issue very much looks like <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="16577582" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/8467" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/8467/hovercard" href="https://github.com/symfony/symfony/issues/8467">#8467</a>, although I believe my use case is different. Because I am not using a user provider at all, anonymous authentication is totally ok.</p>
<p dir="auto">Now, <code class="notranslate">InsufficientAuthenticationException</code> is thrown with <code class="notranslate">AccessDeniedException</code> as a previous exception when I've denied access in my custom voter. I do not see why this first exception is thrown, since I just expect to return a 403 as a response and not a fatal 500.</p>
<p dir="auto">Some more info: I've got two firewalls. One is ignoring all dev related paths. The other simply allows anonymous users. My <code class="notranslate">security.yml</code> looks like this:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="security:
    encoders:
        Acme\DemoBundle\Entity\Person:
            id: acme.demo.blowfish_password_encoder

    providers:
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        default:
            anonymous: ~

    access_control:
        - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }

    access_decision_manager:
        strategy: unanimous"><pre class="notranslate"><span class="pl-ent">security</span>:
    <span class="pl-ent">encoders</span>:
        <span class="pl-ent">Acme\DemoBundle\Entity\Person</span>:
            <span class="pl-ent">id</span>: <span class="pl-s">acme.demo.blowfish_password_encoder</span>

    <span class="pl-ent">providers</span>:
        <span class="pl-ent">in_memory</span>:
            <span class="pl-ent">memory</span>: <span class="pl-c1">~</span>

    <span class="pl-ent">firewalls</span>:
        <span class="pl-ent">dev</span>:
            <span class="pl-ent">pattern</span>: <span class="pl-s">^/(_(profiler|wdt)|css|images|js)/</span>
            <span class="pl-ent">security</span>: <span class="pl-c1">false</span>

        <span class="pl-ent">default</span>:
            <span class="pl-ent">anonymous</span>: <span class="pl-c1">~</span>

    <span class="pl-ent">access_control</span>:
        - <span class="pl-s">{ path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }</span>

    <span class="pl-ent">access_decision_manager</span>:
        <span class="pl-ent">strategy</span>: <span class="pl-s">unanimous</span></pre></div>
<p dir="auto">Can anyone elaborate on this?</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt|fragment)|css|images|js)/
            security: false

        main:
            pattern:    /
            ololo: ~
            provider: users_entity
            anonymous: ~

    access_control:
        - { path: ^/admin, roles: ROLE_ADMIN }"><pre class="notranslate">    <span class="pl-ent">firewalls</span>:
        <span class="pl-ent">dev</span>:
            <span class="pl-ent">pattern</span>:  <span class="pl-s">^/(_(profiler|wdt|fragment)|css|images|js)/</span>
            <span class="pl-ent">security</span>: <span class="pl-c1">false</span>

        <span class="pl-ent">main</span>:
            <span class="pl-ent">pattern</span>:    <span class="pl-s">/</span>
            <span class="pl-ent">ololo</span>: <span class="pl-c1">~</span>
            <span class="pl-ent">provider</span>: <span class="pl-s">users_entity</span>
            <span class="pl-ent">anonymous</span>: <span class="pl-c1">~</span>

    <span class="pl-ent">access_control</span>:
        - <span class="pl-s">{ path: ^/admin, roles: ROLE_ADMIN }</span></pre></div>
<p dir="auto">open as anonymous something like <code class="notranslate">/admin/dashboard</code> and got 500. Expected 403.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2013-07-10 17:27:49] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2013-07-10 17:27:49] security.INFO: No expression found; abstaining from voting. [] []
[2013-07-10 17:27:49] security.DEBUG: Access is denied (user is not fully authenticated) by &quot;/vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php&quot; at line 73; redirecting to authentication entry point [] []
[2013-07-10 17:27:49] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException: &quot;Full authentication is required to access this resource.&quot; at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php line 109 {&quot;exception&quot;:&quot;[object] (Symfony\\Component\\Security\\Core\\Exception\\InsufficientAuthenticationException: Full authentication is required to access this resource. at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php:109, Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException: Access Denied at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php:73)&quot;} []"><pre class="notranslate"><code class="notranslate">[2013-07-10 17:27:49] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2013-07-10 17:27:49] security.INFO: No expression found; abstaining from voting. [] []
[2013-07-10 17:27:49] security.DEBUG: Access is denied (user is not fully authenticated) by "/vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php" at line 73; redirecting to authentication entry point [] []
[2013-07-10 17:27:49] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException: "Full authentication is required to access this resource." at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php line 109 {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\InsufficientAuthenticationException: Full authentication is required to access this resource. at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php:109, Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException: Access Denied at /vhosts/www.ololo.com/new/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php:73)"} []
</code></pre></div>