简体   繁体   English

symfony2调试:尽管上下文相同,但在访问其他防火墙后面的路由时,用户将断开连接

[英]symfony2 debugging: user gets disconnected when accessing routes behind other firewall despite same context

After some debugging, I understood that my user was disconnected from any route under a firewall where anonymous was set to false. 经过一些调试后,我了解到我的用户已从匿名设置为false的防火墙下的任何路由断开连接。

This is strange as it does not happen on my local computer and all was fine until now. 这很奇怪,因为这在我的本地计算机上没有发生,并且到目前为止一切都很好。

How to debug this further? 如何进一步调试?

Please note I have specified the same context for my 2 firewalls, the publicone, and the other one where the issue happens. 请注意,我为我的2个防火墙,publicone和发生问题的另一个防火墙指定了相同的上下文。

My security.yml: 我的security.yml:

app/config/security.yml app / config / security.yml

security:
    # La valeur de « Strategy » peut être : affirmative, unanimous ou consensus
    access_decision_manager:
        strategy: unanimous
    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        guest:
            pattern:        /(public/|$|genemu-captcha-refresh|media/cache/)
            anonymous:      true
            context:        main_auth
        main:
            http_basic: ~
            pattern:        ^/
            anonymous:      false
            provider:       main
            context:        main_auth
            switch_user: { role: ROLE_ADMIN, parameter: _switch_user_parameter }
            form_login:
                login_path: fos_user_security_login
                check_path: fos_user_security_check
                success_handler: authentication_site_handler
            logout:
                path:       fos_user_security_logout
                target:     /
            remember_me:
                key:      "%secret%"
                lifetime: 86400 #en secondes
                path:     /
                domain:   ~ # Prend la valeur par défaut du domaine courant depuis $_SERVER
            oauth:
                remember_me: true
                resource_owners:
                    facebook:           "/loginhwi/check-facebook"
                    github:             "/loginhwi/check-github"
                    google:             "/loginhwi/check-google"
                    twitter:            "/loginhwi/check-twitter"
                    linkedin:           "/loginhwi/check-linkedin"
                    flickr:             "/loginhwi/check-flickr"
                login_path:        fos_user_security_login
                check_path:        fos_user_security_check
                failure_path:      fos_user_security_login
                success_handler:  authentication_site_handler
                oauth_user_provider:
                    service: fosubuser.provider
    providers:
        main:
            id: fos_user.user_provider.username_email
    encoders:
        AppBundle\Entity\User\User: sha512
#Role hierarchy is now managed from the database
#    role_hierarchy:
#        ROLE_SUPER_ADMIN:       [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] #Allowed full access
    access_control:
        - { path: ^/admin, ip: 127.0.0.1, requires_channel: http, roles: ROLE_SUPER_ADMIN }
        - { path: ^/ , roles: IS_AUTHENTICATED_ANONYMOUSLY}

OK, the error came from 好的,错误来自

        http_basic: ~

in the main firewall. 在主防火墙中。 I don't recall why I put it but removing it solved the issue. 我不记得为什么我放了,但是删除它解决了这个问题。

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

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