Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony InvalidConfigurationException for firewall "secured_area"

Tags:

php

symfony

I am new to Symfony and I am trying out different examples shown in Symfony. However, I get the following error with my security.yml file

InvalidConfigurationException in SecurityExtension.php line 430: No authentication listener registered for firewall "secured_area".

My security.yml file looks like this

security:
    providers:
        in_memory:
            memory:
              users:
                foo:
                  password: $2a$12$2nJYjp5DxX0o.ZgGL8ybEOG/MepViC08G1HKVFpjb0BoTDiZd9bCq
                  roles: ROLE_ADMIN

    firewalls:
        secured_area:
            logout:
                path: /logout
                target: /example

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


        default:
            anonymous: ~
            http_basic: ~


    access_control:
        - { path: ^/administer, roles: ROLE_ADMIN }

    encoders:
        Symfony\Component\Security\Core\User\User:
            algorithm: bcrypt
            cost: 12
like image 909
Isaac Bhasme Avatar asked Apr 11 '15 13:04

Isaac Bhasme


Video Answer


1 Answers

Each firewalls key must have defined one or more authentication provider (anonymous, form_login etc.) unless it contains security: false. Your secured_area has registered nothing (logout is not for authentication). Deleting secured_area or moving logout under default key should solve the problem. Right solution depends on what you are trying to achieve.

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


    default:
        anonymous: ~
        http_basic: ~

A "little bit" similar problem security.yml causes InvalidArgumentException: "You must at least add one authentication provider".

like image 200
kba Avatar answered Nov 02 '22 13:11

kba