How do StackExchange sites associate user accounts and OpenID logins?

烂漫一生 提交于 2019-12-20 14:36:48

问题


I love StackExhchange / StackOverflow's approach to integrating OpenID.

As I understand it, the process goes something like this:

  • If a user signs up with an OpenID provider (i.e. Google), StackOverflow (or similar site) creates an account for the user and associates the OpenID with that account.
  • An existing user can associate multiple OpenID accounts with his/her StackExchange account.

I would love to emulate this behavior because I haven't seen it nearly as user-friendly on other sites.

I know StackExchange is built on ASP.NET MVC, but am not sure whether it uses the standard ASP.NET credentialing model and then adds the OpenID provider in a separate DB table or what.

So, my questions are:

  • How does StackExchange create these accounts? Do they Create a user in the standard ASP.NET MVC provider and then associate the ID, or is there a separate process?
  • how does StackExchange allow additional OpenID provider accounts to be associated with an existing account?

Thanks in advance for any help you can give!


回答1:


The StackExchange sites use the DotNetOpenAuth library (previously known as DotNetOpenId library).

You basically need a User table and a User_OpenID table with a one-to-many relationship. Scot Hanselman has a good basic article or try a more in depth overview



来源:https://stackoverflow.com/questions/4395190/how-do-stackexchange-sites-associate-user-accounts-and-openid-logins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!