private void RenderXrds(HttpContext context)
        {
            var xrdsloginuri = new Uri(context.Request.GetUrlRewriter(),
                                       new Uri(context.Request.GetUrlRewriter().AbsolutePath, UriKind.Relative)) + "?auth=openid&returnurl=" + ReturnUrl;
            var xrdsimageuri = new Uri(context.Request.GetUrlRewriter(),
                                       new Uri(context.Request.ApplicationPath, UriKind.Relative)) + "openid.gif";

            XrdsHelper.RenderXrds(context.Response, xrdsloginuri, xrdsimageuri);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string additional = string.Empty;

            if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
            {
                var ticket = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value);
                if (ticket != null)
                {
                    additional = ticket.UserData;
                }
            }
            loginStatus.Text = string.Format("Authentificated:{0} as {1} additional info {2}", User.Identity.IsAuthenticated, User.Identity.Name, additional);

            XrdsHelper.AppendXrdsHeader();
        }
        public void ProcessRequest(HttpContext context)
        {
            var returnUrl = context.Request["returnurl"] ?? FormsAuthentication.LoginUrl;
            var auth      = context.Request["auth"];

            if (!string.IsNullOrEmpty(auth))
            {
                try
                {
                    switch (auth)
                    {
                    case "twitter":
                        DoTwitterLogin(context, returnUrl);
                        break;

                    case "facebook":
                        DoFacebookLogin(context, returnUrl);
                        break;

                    default:
                        DoOpenIdLogin(context, returnUrl);
                        break;
                    }
                }
                catch (ThreadAbortException)
                {
                    //Thats is responce ending
                }
                catch (Exception ex)
                {
                    RedirectToReturnUrl(context, returnUrl, UniversalProfile.FromError(ex));
                }
            }
            else
            {
                //Render xrds
                var xrdsloginuri = new Uri(context.Request.GetUrlRewriter(),
                                           new Uri(context.Request.GetUrlRewriter().AbsolutePath, UriKind.Relative)).ToString() + "?auth=openid&returnurl=" + returnUrl;
                var xrdsimageuri = new Uri(context.Request.GetUrlRewriter(),
                                           new Uri(context.Request.ApplicationPath, UriKind.Relative)).ToString() + "openid.gif";
                XrdsHelper.RenderXrds(context.Response, xrdsloginuri, xrdsimageuri);
            }
        }
Exemple #4
0
 private async Task RenderXrds(HttpContext context)
 {
     var xrdsloginuri = new Uri(context.Request.GetUrlRewriter(), new Uri(context.Request.GetUrlRewriter().AbsolutePath, UriKind.Relative)) + "?auth=openid&returnurl=" + ReturnUrl;
     var xrdsimageuri = new Uri(context.Request.GetUrlRewriter(), new Uri(WebHostEnvironment.WebRootPath, UriKind.Relative)) + "openid.gif";
     await XrdsHelper.RenderXrds(context.Response, xrdsloginuri, xrdsimageuri);
 }