Trying a long shot to fix bitid

This commit is contained in:
Falkvinge
2016-11-25 15:29:39 +01:00
parent f0de9f4731
commit 408dfe393e
2 changed files with 19 additions and 4 deletions
+1 -1
View File
@@ -518,7 +518,7 @@ namespace Swarmops.Frontend
string hostName = this.Request.Url.Host;
string bitIdUri = "bitid://" + hostName + "/Security/Login.aspx?x=" + this.bitIdNonce;
string bitIdUri = "bitid://" + hostName + "/Security/Login.aspx/BitIdLogin?x=" + this.bitIdNonce;
if (this.Request.Url.ToString().StartsWith("http://") && !cloudFlareSsl)
{
+18 -3
View File
@@ -201,8 +201,10 @@ namespace Swarmops.Pages.Security
protected string _cacheVersionMark; // CSS cache buster
protected void ProcessRespondBitId (BitIdCredentials credentials, HttpResponse response)
protected static void ProcessRespondBitId (BitIdCredentials credentials, HttpResponse response)
{
AuthenticationData authData = GetAuthenticationDataAndCulture();
BitcoinPubKeyAddress testAddress = new BitcoinPubKeyAddress (credentials.address);
if (testAddress.VerifyMessage (credentials.uri, credentials.signature))
{
@@ -210,13 +212,13 @@ namespace Swarmops.Pages.Security
try
{
if (CurrentUser != null)
if (authData.CurrentUser != null)
{
if ((string) GuidCache.Get (credentials.uri + "-Intent") == "Register")
{
// the currently logged-on user desires to register this address
// so set currentUser bitid
CurrentUser.BitIdAddress = credentials.address;
authData.CurrentUser.BitIdAddress = credentials.address;
// Then go do something else, I guess? Flag somehow to original page
// that the op is completed?
GuidCache.Set (credentials.uri + "-Intent", "Complete");
@@ -348,6 +350,19 @@ namespace Swarmops.Pages.Security
}
[WebMethod]
public static void BitIdLogin(string address, string signature, string uri)
{
BitIdCredentials credentials = new BitIdCredentials
{
address = address,
signature = signature,
uri = uri
};
ProcessRespondBitId(credentials, HttpContext.Current.Response);
}
protected override void OnPreInit (EventArgs e)
{
base.OnPreInit (e);