Authentification Multiple users issue Symfony2

时间:2017-04-24 17:32:50

标签: php symfony doctrine-orm orm doctrine

I have an issue in the authentification Admin , for the user it works correctly but when i access to /admin/login it redirect me automatically to /login i don't know why and when i insert the username and password of admin it show me Invalids
this my security.yml

security:
encoders:
    AuthentificationBundle\Entity\user:
        algorithm: bcrypt
    AuthentificationBundle\Entity\Admin:
        algorithm: bycrypt

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




providers:
    user:
      entity: { class: AuthentificationBundle:user }
    admin:
      entity: { class: AuthentificationBundle:Admin }


firewalls:
      user_secured_area:
          pattern: ^/
          anonymous: true
          provider: user
          form_login:
              login_path: login
              check_path: login
              use_referer:  false
              success_handler:  after_login_redirection

          logout:
              path: /logout
              target: /login
      admin_secured_area:
          pattern: ^/admin
          anonymous: true
          provider: admin
          form_login:
              login_path: /admin/login
              check_path: /admin/check_login
              use_referer:  false
              success_handler:  after_login_redirection

          logout:
              path: /logout
              target: /login

access_control:
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin, roles: ROLE_ADMIN }

0 个答案:

没有答案