diff --git a/Site5/Security/BitId.aspx.cs b/Site5/Security/BitId.aspx.cs index 88f40dc1..23efea9b 100644 --- a/Site5/Security/BitId.aspx.cs +++ b/Site5/Security/BitId.aspx.cs @@ -4,9 +4,11 @@ using System.IO; using System.Linq; using System.Web; using System.Web.ExtensionMethods; +using System.Web.Security; using System.Web.Services; using System.Web.UI; using System.Web.UI.WebControls; +using Swarmops.Logic.Cache; using Swarmops.Logic.Support; namespace Swarmops.Security @@ -15,20 +17,20 @@ namespace Swarmops.Security { protected void Page_Load(object sender, EventArgs e) { - Persistence.Key["BitIdTest_Raw"] = Request.ToRaw(); - Persistence.Key["BitIdTest_Uri"] = Request.Params["uri"]; - Persistence.Key["BitIdTest_Address"] = Request.Params["address"]; - Persistence.Key["BitIdText_Signature"] = Request.Params["signature"]; + string nonce = Request.Params["Nonce"]; + string identity = GuidCache.Get(nonce + "-Identity") as string; + + if (string.IsNullOrEmpty(identity)) + { + Response.Redirect("Login.aspx"); + } + else + { + GuidCache.Delete(nonce + "-Identity"); + FormsAuthentication.RedirectFromLoginPage(identity, true); + } } - // ReSharper disable once InconsistentNaming - [WebMethod] - public static void callback(string uri, string signature, string address) - { - Persistence.Key["BitIdTest_Uri"] = uri; - Persistence.Key["BitIdTest_Address"] = address; - Persistence.Key["BitIdText_Signature"] = signature; - } } } diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 11df2af0..143d1e81 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -246,8 +246,8 @@ namespace Swarmops.Pages.Security GuidCache.Delete(uri + "-Logon"); GuidCache.Delete(uri + "-LoggedOn"); + GuidCache.Set(nonce + "-Identity", result); - FormsAuthentication.RedirectFromLoginPage(result, true); // set auth cookie return true; } catch (Exception e)