Same webserver, same drupal, same db, single sign

2019-08-08 05:29发布

问题:

I have a webserver with a drupal 7 installed on. Many primary domains are pointing to this webserver (es domain1.com, domain2.com) and each domain is see the same website.

But if i log in into one (domain1.com) when i visit the domain2.com i'm not logged in. I know that is a domain cookie problem, but there is a way to generate the cookie for a list of domain when i register/log in?

Hope that someone can help me

回答1:

Here my module developed for getting a SSO system working with Drupal and Domain Acces.

https://github.com/andreacavattoni/DomainSSO



回答2:

This is the very good question and have done small research on your question on different ways:

OAuth:

After reading the documentation and gone through many service providers it is not possible. Oauth service provider gives the consumer key and secret and they check the request coming from the domain and thus if the same oAuth consumer key is used on different domain Names that doesn't work.

Setting Cookie Multiple domains

Simply, it is not possible to set the cookie without visiting the domain by any means

Thus, I can say that it is not possible to set cookie or use the same consumer key and secret for multiple domains

Alternative ways

  1. Use HTML5 Web Storage for storing the information and then accessing the information from different domains is possible.

  2. Use AJAX/CURL for sending the request for setting the cookie for different domains such as example.com/session_cookie.php?info=xxxxx

  3. Maintain a single sub-domain/page for all the domain for login purpose for across all the domains.



回答3:

I think you may want to look at Bakery

Could be of interest: Stack Exchange Blog: Global Network Auto-Login (using HTML5's local storage)