建筑为多个用户帐户合并在一起 [英] Architecture for merging multiple user accounts together

查看:110
本文介绍了建筑为多个用户帐户合并在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个网站,你可以自己注册并登录。您也可以登录你的Facebook,Twitter或LinkedIn帐户。

Okay, I got a website where you can register yourself and login. You can also login with your facebook, twitter or linkedin account.

这用户只有一个帐户注册是很重要的。所以,不知怎么的,我想如果他们使用不同的方法登录到合并的用户的帐户。什么是解决这个的最佳解决方案?

It is important that users only have one account registered. So somehow, I want to merge the accounts of users if they use different methods to login. What is the best solution to solve this?

有关例如,用户用他的Facebook帐户登录英寸我利用这些数据来为他自动注册一个账号。我发了一封邮件与我们网站的用户名和密码? (如果这是好与Facebook的策略)。我应该给他们第二个屏幕,在那里他们可以在用户名和密码填?但是,这并不落后与你的Facebook帐户登录的想法。它应该简化程序参与。

For instance, the user logs in with his Facebook account. I use the data to register an account for him automatically. Should I sent an e-mail with an username and password of our website? (If this is okay with the policy of Facebook). Should I give them a second screen where they can fill in an username and password? But that's not the idea behind logging in with your Facebook account. It should simplify your procedure to participate.

也有可能用户自己登记在我们的网站,就与他的Twitter帐户登录的下一次。我该如何合并这2个账户为一体?什么是最好的方法是什么?

It's also possible the user has registered himself on our website and the next time he logs in with his twitter account. How can I merge these 2 accounts as one? What's the best way?

所以基本上我的问题是:我有4种不同的方式,用户成为我们网站的会员。我怎样才能确保所有这些4种方式只有当用户决定使用多种方式创建一个帐户?什么是确保它不会成为用户自己麻烦的最佳流量?

So basically my question is: I got 4 different ways a user becomes a member of our website. How can I make sure all these 4 ways only create one account if a user decides to use multiple ways? What's the best flow to make sure that it doesn't become a hassle for the user himself?

编辑:

3年后,我问这个问题,我给自己的答案在一系列的文章:<一href=\"http://www.sitepoint.com/series/using-social-networks-as-a-login-system/\">http://www.sitepoint.com/series/using-social-networks-as-a-login-system/

3 years after I asked this question, I am giving the answer myself in a series of articles: http://www.sitepoint.com/series/using-social-networks-as-a-login-system/

推荐答案

我面对的时刻完全相同的任务。我计算出的设计比较简单,但效果很好。

I am faced with the exact same task at the moment. The design I worked out is rather simple, but it works well.

的核心思想是,型号为本地站点身份和第三方网站的身份被保持分离,但在后面的联系。所以,每一个登录到该网站用户映射到任何数量的第三方网站身份的本地身份。

The core idea is that models for a local site identity and the third-party site identities are kept isolated, but are later linked. So every user that logs into the site has a local identity which maps to any number of third-party site identities.

一个地方的身份记录包含最基本的信息 - 它甚至可以是一个单场 - 只是一个主键。 (我的应用程序,我不关心用户的电子邮件,姓名或出生日期 - 我只是想知道他们是谁一直一直登录到该帐户的人)

A local identity record contains a minimum of information - it could even be a single field - just a primary key. (For my application, I don't care about the user's email, name, or birth date - I just want to know they're the person who has been logging into this account all along.)

第三方身份包含相关仅与第三方身份验证信息。如果是OAuth,这通常意味着用户标识符(如一个ID,电子邮件,用户名)和服务标识符(指什么网站或服务与身份验证)。在应用程序的其他部分,在数据库之外,该服务识别符成对的检索从该服务相关的用户识别符的方法,那就是如何在执行验证。对于OpenID的,我们采用同样的方法,除了验证该方法是一个更广泛的(因为我们几乎总能执行完全相同的协议 - 但我们使用不同的身份的URL,这是我们的服务标识符)。

The third-party identities contain information relevant only to authenticating with a third-party. For OAuth, this typically means a user identifier (like an id, email, or username) and a service identifier (indicating what site or service was authenticated with). In other parts of the application, outside of the database, that service identifier is paired with a method for retrieving the relevant user identifier from that service, and that is how authentication is performed. For OpenID, we employ the same approach, except the method for authenticating is more generalized (because we can almost always perform the exact same protocol - except we use a different identity URL, and that is our service identifier).

最后,我保持一个记录,其中第三方身份配对到什么地方认同。产生这些记录,流程是这样的:

Finally, I keep a records of which third-party identities are paired to what local identity. To generate these records, the flow looks like this:


  • 的用户使用第三方的身份第一次登录英寸本地身份记录被创建的,那么第三方的身份记录,然后将它们配对。

  • 在控制面板,用户所提供的机会,登录到第三方服务链接帐户。 (pretty直截了当如何工作的。)

  • 在其中,用户在不知不觉中让多个账户的情况下,解决办法是pretty简单。当用户登录的帐户之一,他登录到另一个他$ pviously用于登录到该网站(通过控制面板上面的功能)p $。 web服务检测到该冲突(即登录的用户的本地身份从链接到第三方身份,只是将记录在本地身份不同),并且用户被提示的帐户合并。

合并帐户被合并的地方认同的各个领域的问题(这将随着应用而变化,并且应该很容易,如果你只在您的本地身份记录的几个字段),然后确保链接的第三三方的身份被链接到所得到的本地身份。

Merging accounts is a matter of merging each individual field of the local identity (which will vary from application to application, and should be easy if you have only a couple fields in your local identity records), and then ensuring the linked third-party identities are linked to the resultant local identity.

这篇关于建筑为多个用户帐户合并在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆