0

在 symfony2.0 中找不到 login_check(我知道它应该是 symfony2.4,因为它是解密的,但我的客户想要 2.0)。

symfony 找不到 login_check-path 有什么问题?

我的路由.yml:

backend_account_login:
    pattern:  /{_locale}/secured/login
    defaults: { _controller: BackendAccountBundle:Secured:login }
    requirements:
        _locale: en|de

security_check:
  pattern:  /{_locale}/secured/login_check
  requirements:
        _locale: en|de

logout:
  pattern:  /de/secured/logout
  defaults: { _controller: BackendAccountBundle:Secured:logout }

我的security.yml:

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        #Use of an encoder Backend\AccoundBundle\Services
        Backend\AccountBundle\Entity\User:
         id: sha256salted_encoder

    role_hierarchy:
        ROLE_ADMIN:       ROLE_AHA_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    #two providers are given. the aha users from the db and the admin.
    #admin still have an unsecured password
    providers:
        chain_provider:
            providers: [in_memory, user_db]
        in_memory:
            users:
                admin: { password: 2, roles: ROLE_ADMIN }
        #for aha-users there is a custom table. the login procedure is getting the data from the entity        
        user_db:
            entity: { class: Backend\AccountBundle\Entity\User, property: email }

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        login:
            pattern:  ^/(en|de)/secured/login
            #security: false
            anonymous:  ~

        secured_area:
            pattern:    ^/(en|de)/secured/
            anonymous:  ~
            http_basic:
                realm: "Secured Area"
            form_login:
                check_path: security_check
                login_path: backend_account_login
                use_referer:        false
                default_target_path: backend_secured_account_index
                #target_path_parameter: frontend_account_my_account
            logout: 
                path:   /de/secured/logout
                target: /de/
                #default_target_path: frontend_account_login
                #anonymous: ~


#the access of user e.g. admin and aha users are given below
    access_control:
        - { path: ^/*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/(en|de)/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/(en|de)/*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/(en|de)/secured/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/(en|de)/secured/, roles: [ROLE_AHA_USER, ROLE_ADMIN] }
        - { path: ^/(en|de)/secured/account/admin/register/, roles: ROLE_ADMIN }
4

1 回答 1

2

正如 2.0.25 Symfony Dependency Injection 和文档参考(见下文)所建议的那样,您应该将您的 check_path 定义为绝对 url 而不是路由名称。(例如:/en/secured/login_check)

2.0 的安全参考(已弃用): http ://symfony.com/doc/2.0/reference/configuration/security.html#the-login-form-and-process

当前: http ://symfony.com/doc/current/reference/configuration/security.html#the-login-form-and-process (后者表明您可以使用路由名称。)

于 2014-05-30T10:42:09.983 回答