Symfony security.yml - 重定向循环

时间:2015-03-27 17:53:03

标签: php symfony

我有以下security.yml文件。我正试图到达'/ test'路线,登录后,我陷入了一个循环。

有人可以指出事情搞砸了吗?我很难过。

# you can read more about security in the related section of the documentation
# http://symfony.com/doc/current/book/security.html
security:
    # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
    encoders:
        IMAG\LdapBundle\Users\LdapUser: plaintext

    # http://symfony.com/doc/current/book/security.html#hierarchical-roles
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        ldap:
          id: imag_ldap.security.user.provider
    # the main part of the security, where you can set up firewalls
    # for specific sections of your app
    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        public:
          pattern: ^/login
          security: false
        dev:
          pattern:  ^/(_(profiler|wdt)|css|images|js)/
          security: false

        restricted_area:
          pattern:  ^/
          anonymous: ~
          imag_ldap:
            check_path: login_check
            login_path: login
            intention: authenticate
            provider: ldap
          logout:
            path: /logout
            target: /

    # with these settings you can restrict or allow access for different parts
    # of your application based on roles, ip, host or methods
    # http://symfony.com/doc/current/cookbook/security/access_control.html
    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, roles: IS_AUTHENTICATED_FULLY }
        #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }

1 个答案:

答案 0 :(得分:1)

如果您的登录检查路径为" login_check"

,则更改登录模式
public:
      pattern: ^/login$