I think you can achieve this with FOSBundle ( the bundle meant for security)

I've not implemented this bundle yet. But in the meanwhile I'm doing a
redirection to /loginredirect route on login success whatever user is
authenticated.

This route has a simple controller that check the role of the user, and
makes a redirection to the user's homepage according to his role.

This is a little bit clumsy but it is working for me till I implement to
FOSBundle :D

This is the entry for secured_area in security.yml:

secured_area:

            pattern:    ^/
            form_login:
                check_path: /login_check
                login_path: /login
                *always_use_default_target_path: true*
*                default_target_path:            /loginredirect*
*
*
*
*
2011/5/14 user123 <zolzaya...@gmail.com>

> 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
>

-- 
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

Reply via email to