Symfony安全性,重定向太多

时间:2017-01-08 14:39:11

标签: php symfony

我正在尝试设置安全性和身份验证,我尝试按照symfony教程,但现在当我尝试访问任何页面时,我得到localhost redirected you too many times.如果你没有登录我想重定向到登录页面在和访问安全页面。

这是我的security.yml文件

安全性:

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

encoders:
    Akon\UserBundle\Entity\User:
        algorithm: bcrypt



providers:
    akon:
        entity:
            class: AkonUserBundle:User


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

    main:
        pattern:    ^/
        provider: akon
        form_login:
            login_path:    akon_user_login
            check_path:    akon_user_login
        logout:
            path:   /logout
            target: /              


access_control:
    # require ROLE_ADMIN for /register*
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    #- { path: ^/, roles: ROLE_USER }

阿肯/ UserBundle /资源/配置/ routing.yml中

akon_user_homepage:
    path:     /
    defaults: { _controller: AkonUserBundle:Default:index }

akon_user_register:
    path:     /register
    defaults: { _controller: AkonUserBundle:Default:Register}

akon_user_login:
    path:     /login
    defaults: { _controller: AkonUserBundle:Security:Login}


logout:
    path: /logout

0 个答案:

没有答案