防火墙不起作用Symfony3

时间:2017-04-30 15:42:40

标签: firewall symfony-3.2

我正在尝试配置防火墙,但是当我继续http://localhost/project1/web/app_dev.php/

时,我并没有重新登录页面

我已经在其他symfony2项目上使用了这种类似的配置,我从来没有遇到过这个问题。

也许我忘了做某事......我做了一个缓存:清除但之后没有结果。

我的security.yml:

# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    # http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                login_path: /login
                check_path: /login_check
                csrf_token_generator: security.csrf.token_manager
            logout:
                path:   /logout
                target: /
            anonymous:    ~

        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_ADMIN }
        - { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }
            # activate different ways to authenticate

            # http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
            #http_basic: ~

            # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
            #form_login: ~

0 个答案:

没有答案