简体   繁体   English

Symfony security.yml-重定向循环

[英]Symfony security.yml - redirect loop

I have the below security.yml file. 我有下面的security.yml文件。 I am trying to reach the route '/test', and after logging in, i get stuck in a loop. 我试图到达路由“ / test”,并且登录后陷入了循环。

Can someone please point out where things are messed up? 有人可以指出哪里搞砸了吗? I'm stumped. 我很沮丧

# 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 }

change login pattern if your login check path is "login_check" 如果您的登录检查路径为“ login_check”,请更改登录方式

public:
      pattern: ^/login$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM