Ejemplo n.º 1
0
        public RedirectResult SignIn(string code, string error, string returnToUrl, string provider)
        {
            if (error != null)
            {
                return Redirect(Session["returnToUrl"].ToString());
            }
            else if (code == null)
            {
                _oAuthProvider = getOAuthProvider(provider);

                if (_oAuthProvider == null)
                {
                    return Redirect(returnToUrl);
                }

                Session.Add("returnToUrl", returnToUrl);
                Session.Add("provider", provider);

                return Redirect(_oAuthProvider.GetCodeUrl());
            }
            else
            {
                _oAuthProvider = getOAuthProvider(Session["provider"].ToString());

                if (_oAuthProvider == null)
                {
                    return Redirect(Session["returnToUrl"].ToString());
                }

                OAuthUser oAuthUser = _oAuthProvider.GetOAuthUser(code);
                Session.Add("oAuthUser", oAuthUser);

                return Redirect(Session["returnToUrl"].ToString());
            }
        }
Ejemplo n.º 2
0
        public RedirectResult SignIn(string code, string error, string returnToUrl, string provider)
        {
            if (error != null)
            {
                return(Redirect(Session["returnToUrl"].ToString()));
            }
            else if (code == null)
            {
                _oAuthProvider = getOAuthProvider(provider);

                if (_oAuthProvider == null)
                {
                    return(Redirect(returnToUrl));
                }

                Session.Add("returnToUrl", returnToUrl);
                Session.Add("provider", provider);

                return(Redirect(_oAuthProvider.GetCodeUrl()));
            }
            else
            {
                _oAuthProvider = getOAuthProvider(Session["provider"].ToString());

                if (_oAuthProvider == null)
                {
                    return(Redirect(Session["returnToUrl"].ToString()));
                }

                OAuthUser oAuthUser = _oAuthProvider.GetOAuthUser(code);
                Session.Add("oAuthUser", oAuthUser);

                return(Redirect(Session["returnToUrl"].ToString()));
            }
        }