Why doesn't ServiceStack always link UserAuth and UserAuthDetails?

时光怂恿深爱的人放手 提交于 2019-12-11 19:32:18

问题


I am struggling with something that I would have thought ServiceStack would do "out of the box"...

I have a ServiceStack API that allows authentication via credentials, basic, google OpenId and LinkedIn OAuth2.

Starting with empty UserAuth and UserAuthDetails table I have found that if I:

  1. start my app and use credentials to log in
  2. log out
  3. log in using Google OpenId auth

ServiceStack creates two separate UserAuth records rather than linking the Google UserAuthDetail with the Credential authenticated UserAuth. This is despite the two credentials showing the same email address in both records.

BUT... If I start from a blank database and repeat the steps using the LinkedIn OAuth2 I find that a single UserAuth record is created with a linked UserAuthDetails record. This is what I want the Google Auth to do.

Can anyone shed any light on why this is happening and what I must do to ensure the Google Auth doesn't create a new UserAuth if there is already one with a matching email address?


回答1:


ServiceStack merges User Auth details for the current authenticated user session. i.e. not on any matching value returned by the OpenId/OAuth providers.

If you log out, then you end the current users session and authenticating again will behave as if it were a new browser session.



来源:https://stackoverflow.com/questions/22492917/why-doesnt-servicestack-always-link-userauth-and-userauthdetails

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