OAuthLogin2.0 Introduction Address: Entry Address:http://www.cnblogs.com/dazhuangtage/p/6306133.html NuGet Address:https://www.nuget.org/packages/OAuthLogin2.0/
a few questions about the comments of the friends in the previous article:1: Why are there so many useless platforms built in? A: The built-in platform is the last e-commerce project used by the platform, yesterday in a project, the need to use QQ login, I took this project expanded under. Then I thought I should be able to help other people and then let it out.
2: Open source address????? answer: Look back .....
I do not think I am a good writer, so I prefer, the following I put on the architecture diagram, you see the picture should be easier to understand:platform naming mechanism:
the relationship between the platform and the application:
User Authorization process:
Authorization Callback Procedure:
Exception handling mechanism:
MVC Use Tutorial:
public actionresult Auth (string Span style= "COLOR: #000000" > Etpname) { var etp = etpname.fromstring (etpname); var platefrom = Platform.find (ETP); if (Platefrom = = null " return Content ( " /span> Unsupported third-party login platform! " return Redirect (platefrom.applications[ 0 ]. Generateauthorizationurl (Etpname)); }
Callback method:
Public AsyncTask<actionresult>Authcallback () {varState = request.querystring[" State"]; varETP =etpname.fromstring (state); varPlatefrom =Platform.find (ETP); if(Platefrom = =NULL) returnContent ("Callback parameter Error!"); varTokent =awaitplatefrom.applications[0]. Gettokenasync (System.Web.HttpContext.Current.Request); if(string. IsNullOrEmpty (tokent. OpenId)) {returnContent ("failed to get user information!"); } returnContent ("Get user Information success!"+tokent. ToString ()); }
Open Source Address: https://github.com/dazhuangtage/OAuthLogin2.0
There is also a oauthmanager framework, used to manage the authorization information, do not know that there is no use for everyone ... Anyway, at the moment I'm using .... The oAuthManager framework references the dbcontent architecture of EF. People feel useful, just a praise it ...
Open source Third party login component OAuthLogin2.0 Schema parsing and open source address