Symfony 3 - новые брандмауэры всегда перенаправляют на главную страницу

Используя Symfony 3, я настроил несколько брандмауэров. У меня проблема в том, что работает только один брандмауэр. Когда я устанавливаю новые брандмауэры, он всегда перенаправляет на главную страницу.

Ниже приведен мой код файла security.yml

# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:       

encoders:
    AppBundle\Entity\User:
        algorithm: bcrypt
        cost: 12

    ClientBundle\Entity\SuperAdmin:
        algorithm: bcrypt
        cost: 12

providers:
    user:
        entity:
            class: AppBundle:User
            property: email

    simplesaml:
        id: my_user_provider

    client:
       entity:
            class: ClientBundle:SuperAdmin 
            property: email


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

    client_login:
        pattern:  ^/client/login$
        security: false  

    user_login:
        pattern:  ^/user/login$
        security: false    

    user_secured_area:
        pattern:   ^/user
        anonymous: ~
        provider: user
        form_login:
            login_path: /user/login
            check_path: /user/login
            use_referer: true
            success_handler: app_user_security.login_success_handler
            require_previous_session: false

        remember_me:
            secret:   '%secret%'
            lifetime: 604800
            path:     /user/login
            always_remember_me: true

        logout:
            path:   /user/logout
            target: /user/login

    client_secured_area:
        pattern:   ^/client
        anonymous: ~
        provider: client
        form_login:
            login_path: /client/login
            check_path: /client/login
            default_target_path: /client/logindss

        remember_me:
            secret:   '%secret%'
            lifetime: 604800
            path:     /client/
            always_remember_me: true

        logout:
            path:   /client/logout
            target: /client/login        

    saml:
        pattern:    ^/saml
        anonymous: true
        stateless:  true
        simple_preauth:
           authenticator: simplesamlphp.authenticator
           provider: simplesaml
        logout:
            path:   /logout
            success_handler: simplesamlphp.logout_handler

access_control:
    - { path: ^/client/, roles : IS_AUTHENTICATED_ANONYMOUSLY}

Я создал новый пакет для входа в систему клиента, а другие appbundle - для входа обычного пользователя. Я хочу сделать 2 отдельных входа в систему с разными страницами.

пожалуйста помоги

1 ответ

Согласно официальной документации, вы пытаетесь использовать _target_path в вашей форме входа?

<form action="{{ path('login') }}" method="post">
    {# ... #}

    <input type="hidden" name="_target_path" value="{{ path('account') }}" />
    <input type="submit" name="login" />
</form>
Другие вопросы по тегам