logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$4
Single login page for multiple Symfony apps

Hi,

I need to have a single login page for multiple Symfony apps. The login page is a Symfony app as well. All of these apps belong to the same Project (they will share some common data model elemtents).

The idea is that according to which app the user belongs to, the user will be forwarded after login to that app's homepage. The user won't be able to access pages in other apps.

The login app will have a db with the users, besides that, each app will access its own database.

How do I implement this??

This question has been answered.

fxsymfony | 02/02/11 at 7:32pm Edit


(9) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    02/04/11
    1:30am
    Nate Flink says:

    You want to use the sfGuard plugin. This is the defacto login module for the symfony framework, that everyone uses, and is stable and fairly well developed.

    It will handle the whole user management piece for you. You can use the same login facility for different apps, and you can override / customize the functionality as well.

    http://www.symfony-project.org/plugins/sfGuardPlugin


    Response:

    1) It should be possible to write an import script to move your existing users over to the sfGuardUser and sfGuardUserProfile tables, while preserving the existing keys.

    2) sfGuard plugin comes in both a propel and a doctrine version. Here is the doctrine version: http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin

    Previous versions of this answer: 02/02/11 at 10:17pm | 02/03/11 at 10:11am

  • avatar
    Last edited:
    02/04/11
    1:30am
    Bill Hunt says:

    As mentioned above, sfGuard is a great way to do this - there's also sfDoctrineGuardPlugin to handle your Doctrine requirement. You can use a custom method to validate your users using the old tables you've got, and a little fancy routing and re-routing can handle taking the user to a different page after login.

    http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin

  • avatar
    Last edited:
    02/03/11
    1:07am
    fxsymfony says:

    Ok that looks promising.

    I have one concern thou, I already have a table with the users, and their ids are foreign keys in other tables. The application has been running for a while and the db is big, from what I read about sfGuardPlugin it seems its expected to be used from the very start. Do you know if its possible to adapt sfGuardPlugin to an existing app like mine?

  • avatar
    Last edited:
    02/03/11
    1:12am
    fxsymfony says:

    also, my app uses Doctrine not Propel :S

  • avatar
    Last edited:
    02/03/11
    7:51pm
    fxsymfony says:

    I see.. what kind of script would I need to transfer the users while keeping the keys to the other tables? Just changed in the YAML file or some MySQL script?

  • avatar
    Last edited:
    02/03/11
    7:52pm
    fxsymfony says:

    So u say I could keep my current User table and somehow link it to the new ones SfGuard creates? any hints on how to achieve that?

  • avatar
    Last edited:
    02/03/11
    7:59pm
    Bill Hunt says:

    RTFM. ;) It's not that hard, really.
    http://raw.trac.symfony-project.org/wiki/sfGuardDoctrinePlugin

  • avatar
    Last edited:
    02/04/11
    12:17am
    fxsymfony says:

    Ok I installed sfGuardDoctrine, it seems very powerful I wonder why it doesn't just come as part as Symfony.

    Anyway. Going back to the original question of this post.. any hints on how the single login for different apps can be achieved using this plugin?

    Cheers

  • avatar
    Last edited:
    02/04/11
    1:29am
    fxsymfony says:

    got it! the plugin makes it very easy.

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.