I have a login for the interface (which is optional) and another login for the admin panel, which is required.
When the user goes to fe_login , he can enter the frontend context. This is normal!
When they go to admin_login , they must enter the admin context. It's not ok
The problem is that when I go to /admin , I redirect to fe_login , when I need to redirect to admin_login
Here is my security.yml :
security: encoders: App\FrontendBundle\Controller\UserController: algorithm: bcrypt App\AdminBundle\Controller\UserController: algorithm: bcrypt App\Entity\User: algorithm: bcrypt providers: administrators: entity: { class: AppEntity:User, property: username } firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false admin: pattern: ^/admin form_login: login_path: admin_login check_path: admin_auth csrf_provider: form.csrf_provider logout: path: admin_logout target: admin_login frontend: anonymous: ~ form_login: login_path: fe_login check_path: fe_auth csrf_provider: form.csrf_provider always_use_default_target_path: true default_target_path: fe_landing logout: path: fe_logout target: fe_landing login: pattern: ^/admin/login anonymous: ~ default: anonymous: ~ access_control: - { path: ^/admin/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin, roles: [ROLE_ADMIN,ROLE_MANAGER,ROLE_DRIVER,ROLE_PARTNER] }
Any idea what I'm doing wrong?
source share