Jump to content

Remote Authentication?


roopurt18

Recommended Posts

That really depends on how the systems are setup currently. You could make a new table and keep two copies of it, one on each server. When a user logged in on either system, the server could send a request to the other server to let it know to store a new session record, and the session records could be stored in cookies because they'll expire.

 

So, lets say I log in at Site A. Site A adds me to it's session table, it stores my user id, a timestamp, and a huge hash. Then, it sends all that data to Site B, which makes an identical record. It also stores the hash as a cookie on my computer. Now, whenever I go to either site, it just checks to make sure I have a valid hash, and if I do, I'm logged in.

 

The easiest way to do the server to server communication is probably http requests, that way you don't need anything except Apache (ie: no persistently running socket apps) I think you can use file_get_contents to send get parameters in the URL, but if you want something a lot more robust, Manuel Lemos wrote a CURL alternative that handles get, post and even file transfers.

I think I know how this can be done, but I don't like it.

 

User logs into site A and authenticates as normal.  In addition, site A generates a unique hash and sends it to site B along with the user it belongs to.  Site B stores the hash.  In the final output, include an img-tag that points to a script on site B; this script must accept the unique hash generated previously.  The browser will try and load the image and hit the script on site B, which can compare the provided hash to its database.  If the hash is found in the database, site B also starts a session and stores info for the user being logged in.

 

Then site A can link to site B normally and site B should pick up that the user is logged in.  It's messy and I really don't want to implement it though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.