I had to implement something similar and here is how i did it. I created a kernel listener and listened for the onSecurityInteractiveLogin and onCoreResponse events. In the onSecurityInteractiveLogin listener you want to set a flag in your object whether or not to redirect the user to the admin page. If the user is not an admin then he will be redirected to whatever is set in your security.yml
Here is a pastebin of the basic class. It should give you an idea of what I am talking about: http://pastebin.com/kcd5DjsS. Obviously you may need to customize it further to suit your needs. Here is my service definition: http://pastebin.com/KhQf9A1U Dustin On May 14, 5:34 am, user123 <zolzaya...@gmail.com> wrote: > Hi guys, > I have login and I want to if admin login go to admin/index, if user > login go to home/index page. How to do it using security.yml in > Symfony 2.0 Beta1? > > I'm put my security.yml file: > security: > encoders: > App\SecurityBundle\Entity\User: > algorithm: sha512 > encode-as-base64: true > iterations: 10 > > providers: > backend: > entity: { class: AppSecurityBundle:User, property: > username } > > firewalls: > backend: > pattern: /admin/.* > form_login: > check_path: /login_check > login_path: /login > logout: true > security: true > anonymous: true > public: > pattern: /.* > security: false > > access_control: > - { path: /admin/.*, role: ROLE_ADMIN } > - { path: /.*, role: IS_AUTHENTICATED_ANONYMOUSLY } -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en