More fixes for invalid auth coookies

This commit is contained in:
Rick Falkvinge
2015-04-18 13:20:12 +02:00
parent e2bb88172e
commit 86b5bab6d5
2 changed files with 17 additions and 7 deletions
+5 -4
View File
@@ -1,6 +1,7 @@
using System;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using Swarmops.Common.Enums;
using Swarmops.Logic.Security;
@@ -54,13 +55,13 @@ public class DataV5Base : Page
{
try
{
CurrentAuthority = Authority.FromEncryptedXml(identity);
CurrentAuthority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
}
catch (Exception)
{
// if this fails FOR ANY REASON, we're unauthenticated
CurrentAuthority = null;
// if this fails FOR WHATEVER REASON then we're not authenticated
this.CurrentAuthority = null;
FormsAuthentication.SignOut();
}
}
else
+12 -3
View File
@@ -22,9 +22,18 @@ namespace Swarmops
{
protected void Page_Init (object sender, EventArgs e)
{
this._authority =
AuthenticationData.FromAuthority (Authority.FromEncryptedXml (HttpContext.Current.User.Identity.Name))
.Authority;
try
{
this._authority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
}
catch (Exception)
{
// if this fails FOR WHATEVER REASON then we're not authenticated
this._authority = null;
FormsAuthentication.SignOut();
Response.Redirect("/");
}
}
protected void Page_Load (object sender, EventArgs e)