Two separate login pages in Symfony 2

I'm trying to figure out how to have two separate login pages: the default entry for the page .comand one for specific users, for example, for the route /special.

Is this possible in one SF2 project?

UPDATE:

I have the following configuration in my firewall (I use fosub)

providers:
    custom:
        id: ib.user_provider
    fos_userbundle:
        id: fos_user.user_manager
    my_fos_facebook_provider:
        id: my.facebook.user

firewalls:
    special:
        pattern: ^/special
        form_login:
            provider: fos_userbundle
            login_path: /special/login
            check_path: /special/login_check
            use_referer: false
            default_target_path: /special
            success_handler: ib.login_handler
            provider: custom
    main:
        pattern: ^/.*
        form_login:
            provider: fos_userbundle
            login_path: /login
            check_path: /login_check
            use_referer: false
            default_target_path: /
            provider: custom
        fos_facebook:
            always_use_default_target_path: true
            app_url: "http://apps.facebook.com/%facebook_app_id%/"
            server_url: "http://aw.com/aw/web/app_dev.php/"
            login_path: /login
            check_path: /login_check/facebook
            default_target_path: /checkFB
            success_handler: facebook_auth_success_handler
            provider: my_fos_facebook_provider
        logout:
            #handlers: ["fos_facebook.logout_handler"]
            target: /
        anonymous:    ~  

In ib.login_handler, I have the following:

public function onAuthenticationSuccess(Request $request,TokenInterface $token)
{
    if ($this->security->isGranted('ROLE_CATEGORIZER'))
    {
        $response = new RedirectResponse($this->router->generate('MyCoBundle_mailAdmin_index'));
    }


    return $response;
}

With this configuration, if I go to mydomain.com/special, I get the following error: Fehler: Umleitungsfehler (in English: error: redirect error)

UPDATE:

in chrome i get: route not found for "GET / special / login"

404 Not Found - NotFoundHttpException
1 linked Exception: ResourceNotFoundException »

I do not have a special route for this entry path. What I want to achieve is simply that the special user has only access to the pages under the outline / special.

+3
1

, = > .

app/config/security.yml, , :

firewalls:

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

    special_area:
        pattern:  ^/special
        anonymous: ~
        form_login:
            check_path: /special/login_check
            login_path: /special/login
        logout:
            path:   /special/logout
            target: /

    general_area:
        pattern:  ^
        anonymous: ~
        form_login:
            check_path: /login_check
            login_path: /login
        logout:
            path:   /logout
            target: /


access_control:
    - { path: ^/_internal, role: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }

    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/special/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }

, special_area genereal_area, general_area ...

routing.yml:

_security_login_special:
    pattern:  /special/login
    defaults: { _controller: FOSUserBundle:Security:login }

_security_check_special:
    pattern:  /special/login_check

_security_logout_special:
    pattern:  /special/logout

general_area, FOSUserManager ... ( : https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.0/Resources/doc/user_manager.md)

+8

All Articles