database - SSO system between 2 WordPress installs on different servers

This is essentially a repeat of this question, but it has not been answered.I am trying to create an SSO system between

This is essentially a repeat of this question, but it has not been answered.

I am trying to create an SSO system between two separate WordPress installs that are on different servers using different databases. The main site has a full database including a users table containing over 300,000 users. Because of the size of the users table, we do not want to replicate each of them on the second site or do a traditional SSO system where each user is created in the database as they login. Ideally, we would like to reference the users table on the main site and use those same users on the second site.

So far I have tried using wp_remote_post() to send a user object to the second site while overriding the pluggable.php functions and setting the $current_user global with the posted user object. This, however, isn't working as well as I'd hoped because the methods that are normally available in the WP_User object are not available in the posted object, which results in fatal errors when methods like $user->exists() are used.

I am aware of the CUSTOM_USER_TABLE solution, but that obviously won't work in this example as the sites are on separate servers with separate databases.

TL;DR: Need SSO. Separate servers. Help.

This is essentially a repeat of this question, but it has not been answered.

I am trying to create an SSO system between two separate WordPress installs that are on different servers using different databases. The main site has a full database including a users table containing over 300,000 users. Because of the size of the users table, we do not want to replicate each of them on the second site or do a traditional SSO system where each user is created in the database as they login. Ideally, we would like to reference the users table on the main site and use those same users on the second site.

So far I have tried using wp_remote_post() to send a user object to the second site while overriding the pluggable.php functions and setting the $current_user global with the posted user object. This, however, isn't working as well as I'd hoped because the methods that are normally available in the WP_User object are not available in the posted object, which results in fatal errors when methods like $user->exists() are used.

I am aware of the CUSTOM_USER_TABLE solution, but that obviously won't work in this example as the sites are on separate servers with separate databases.

TL;DR: Need SSO. Separate servers. Help.

Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Dec 14, 2012 at 13:52 Hugh LashbrookeHugh Lashbrooke 911 silver badge7 bronze badges 3
  • 1 Are you sure you can't access the main site's DB from a different domain/server? Because if you can do this, then you can use one DB for both sites and then you can use the suggestions from the other question. This will almost certainly have an impact on performance, since it will query a different server. If you can't do that, you should consider some kind of syncing between both databases, or maybe trying a WP Multisite network(this will require both domains to point to the same server though). Other than that I really can't figure-out a way to do this without maybe hacking core files. – Nikola Ivanov Nikolov Commented Dec 14, 2012 at 14:08
  • Thanks, but we're trying to keep them separate so we don't sacrifice space and performance on the main site. We could use the same DB server, but we only want to share the users table and keep the posts, etc. separate. I think the only solution might be an SSO system that creates the users on the second site, but that's not ideal. – Hugh Lashbrooke Commented Dec 14, 2012 at 14:14
  • The problem is that WordPress is made to use one database server for everything. So, I really doubt that what you're trying to do is achievable with WP as a base. I mean even if you rewrite the WP_User object to make queries to the original DB, you will still add load to it, which is definitely not good for it(considering the amount of load that it should already have). Sorry, I can't help you with that :/ Good luck with it and if you figure it out, post the answer here :) – Nikola Ivanov Nikolov Commented Dec 14, 2012 at 14:22
Add a comment  | 

2 Answers 2

Reset to default 0

After a lot of searching and asking people who are far more clued up than myself, I have concluded that this is impossible mainly because it requires two concurrent DB connections.

In the end, my SSO solution was to build a more traditional SSO system that creates users in the remote site using the user data from the main site. It also updates them on each login to make sure the profiles always stay up to date.

I do think that that is possible. In fact, I'm trying to do it myself. I'm a recent premium subscriber at WPMUdev, and there you have several topics on their support forums about this subject.

Although installing Wordpress Multisite gives you access to that option from the start, if you've got different domains you have to create a network for each of them, and then "connect" them with plugins such as Multi Domains, as explained here

I haven't been able to set this up the right way, so in the mean time I've been experimenting with the User Synchronization plugin and this one is quite useful because once the user is registered in one blog, it is registered also on the rest of blogs. The disadvantage: you still have to logon on each site you visit.

I'd like to add a definitive solution, but that could be good starting point.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745259753a4619157.html

相关推荐

  • database - SSO system between 2 WordPress installs on different servers

    This is essentially a repeat of this question, but it has not been answered.I am trying to create an SSO system between

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信