Hi, I have setup a multisite (with subdirectories) with separate user tables. We have a "front site" and X number of multisites, where each user belongs to (typically) only one of the multisites. Now we want to enable a shared login at the front site and the requirement is that the login box should only present user name and password, ie not a selection of the subsite to login to (that would complicate the login for user which should be as smooth as possible).
Can this be done? I'm developing my own login box based on the user.module login box. I will iterate over the multisite's user tables until I find a match, so that I know which site the user should be logged in to. But then I have failed to figure out what to do...
-
Maybe redirect to that subsite. But can I do a redirect and also supply the POST data that I have from the login box, to do a proper login programatically? I want to change the URL so that users see where they have logged in, so doing it on the server side is not enough.
-
I have experimented with loading the subsite's settings.php in my login block, so that authentication should be done against the subsite's db tables. If this succeeds I could then do a simple redirect and the user would already be logged in at the subsite. This almost seems to work, but even if I code that bootstrap.inc (core hack!) should load the subsite's settings.php (which it seems to do very frequently), it still goes back to load my front site's settings once in a while.
There may be an easy solution to this, but I have been unable to find it. Anyone?
Thanks,
Claes
Comments
Have you tried messing w/ sessions / authmap
I know to allow authentication from a third party service that we use the authmap table. Maybe if you put in an entry that was aid (auto generated), uid (the uid of the one on the current site), username (the one from each of the other sites), and authority.... dono what that should be as I've only done it for our own module. I set the $_SERVER['REMOTE_USER'] variable to make it happen... Check out webserver auth as our webaccess module is a bastardization of it :) http://drupal.org/project/webserver_auth
Ex Uno Plures
http://elmsln.org/
http://btopro.com/
http://drupal.psu.edu/
Maybe a bad idea to start with
Hi, thanks for your help! I'm guessing authmap could help me implement suggestion 2 above. My front site would authenticate the user and if everything looks ok it would insert the entry in authmap for the subsite to handle with user_external_load(). It still feels a bit cumbersome to handle that, as well as removing entries from the table during logout and doing all the stuff with blocked users etc that the user module now handles.
Suggestion 1 would probably also be doable with drupal_http_request() from my own login box to the user.module login box at my subsite. Ie, I can do a POST to the subsite in my form handler, and then a GET redirect to the subsite once the login has succeeded. However, I have to handle if anything fails during login and display the proper message to the user (which probably is embedded in the data of the response from drupal_http_request).
I'm starting to feel it's not worth it and maybe it is better to try to adapt the requirements so that the user needs to select the subsite to login to.
Thanks,
Claes
Have you thought about
Have you thought about implementing open ID? This should allow the same thing, even if it's just clicking login on the subsequent sites that they go to.
Ex Uno Plures
http://elmsln.org/
http://btopro.com/
http://drupal.psu.edu/
No...
...OpenID may be a neat idea, but not too many users have it yet and requiring that would defeat our purpose of as simple registration and login as possible. I think I will let this rest for a while, while considering other parts of the application. If I finally come up with something, I will tell you here.
Thanks for the help though!
/Claes