Example #1
0
 public void CreateOAuthClient(AbstractClientProvider oClient)
 {
     _client = oClient;
 }
Example #2
0
 protected BaseOauth2Service(AbstractClientProvider oClient)
 {
     _client = oClient;
 }
Example #3
0
 public void CreateOAuthClient(IOAuthContext oContext)
 {
     _client = oContext.Client;
 }
Example #4
0
 public FacebookService(AbstractClientProvider oClient) : base(oClient)
 {
 }
Example #5
0
 public GoogleService(AbstractClientProvider oClient) : base(oClient)
 {
 }
 public FacebookService(AbstractClientProvider oClient, string absoluteUri) : base(oClient, absoluteUri)
 {
 }
 public FacebookService(AbstractClientProvider oCleint)
 {
     _client = oCleint;
 }
Example #8
0
 public GoogleService(AbstractClientProvider oClient, string absoluteUri) : base(oClient, absoluteUri)
 {
 }
 public PayPalService(AbstractClientProvider oCleint)
 {
     _client = oCleint;
 }
 public TwitterService(AbstractClientProvider oClient) : base(oClient)
 {
 }
Example #11
0
 public WindowsLiveService(AbstractClientProvider oCleint)
 {
     _client = oCleint;
 }
 protected BaseOauth2Service(AbstractClientProvider oClient, string absoluteUri = null)
 {
     _client      = oClient;
     _AbsoluteUri = absoluteUri;
 }
Example #13
0
 public FamilyXiaoService(AbstractClientProvider oClient) : base(oClient)
 {
 }
Example #14
0
 public PayPalService(AbstractClientProvider oClient)
     : base(oClient)
 {
 }
Example #15
0
 public GoogleService(AbstractClientProvider oCleint)
 {
     _client = oCleint;
 }
Example #16
0
        public ActionResult Login(string id = "", string bindpage = "")
        {
            string url = "";
            AbstractClientProvider client = null;

            try
            {
                switch (id.ToLower())
                {
                case "google":
                    client = Oauth2LoginFactory.CreateClient <GoogleClinet>("Google");
                    break;

                case "facebook":
                    client = Oauth2LoginFactory.CreateClient <FacebookClient>("Facebook");
                    break;

                case "windowslive":
                    client = Oauth2LoginFactory.CreateClient <WindowsLiveClient>("WindowsLive");
                    break;

                case "paypal":
                    client = Oauth2LoginFactory.CreateClient <PayPalClient>("PayPal");
                    break;

                default:
                    return(RedirectToAction("index"));
                }
                if (client != null)
                {
                    if (bindpage.Equals("1"))
                    {
                        client.CallBackUrl += "?bindpage=1";
                    }
                    _context = Oauth2LoginContext.Create(client);
                    url      = _context.BeginAuth();
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Json(new { Url = url }));

            #region old
            // private static MultiOAuthContext _context;
            //string url = "";
            //IClientProvider client;
            //try
            //{
            //    switch (id.ToLower())
            //    {
            //        case "google":
            //            client = MultiOAuthFactroy.CreateClient<GoogleClinet>("Google");
            //            break;
            //        case "facebook":
            //            client = MultiOAuthFactroy.CreateClient<FacebookClient>("Facebook");
            //            break;
            //        case "windowslive":
            //            client = MultiOAuthFactroy.CreateClient<WindowsLiveClient>("WindowsLive");
            //            break;
            //        default:
            //            return RedirectToAction("index");
            //    }
            //    if (client != null)
            //    {
            //        if (bindpage.Equals("1"))
            //            client.CallBackUrl += "?bindpage=1";
            //        _context = MultiOAuthContext.Create(client);
            //        url = _context.BeginAuth();
            //    }
            //}
            //catch (Exception)
            //{
            //    throw;
            //}

            //return Json(new { Url = url });
            #endregion
        }