1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-28 03:51:23 +01:00

app in review flag for iap receipt validation

This commit is contained in:
Kyle Spearrin 2019-09-29 20:42:53 -04:00
parent 7b75e134d8
commit 5fd9df3beb
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,6 @@ namespace Bit.Core
public virtual bool DisableUserRegistration { get; set; }
public virtual bool DisableEmailNewDevice { get; set; }
public virtual int OrganizationInviteExpirationHours { get; set; } = 120; // 5 days
public virtual string AppleIapPassword { get; set; }
public virtual InstallationSettings Installation { get; set; } = new InstallationSettings();
public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings();
public virtual SqlSettings SqlServer { get; set; } = new SqlSettings();
@ -39,6 +38,7 @@ namespace Bit.Core
public virtual BitPaySettings BitPay { get; set; } = new BitPaySettings();
public virtual AmazonSettings Amazon { get; set; } = new AmazonSettings();
public virtual ServiceBusSettings ServiceBus { get; set; } = new ServiceBusSettings();
public virtual AppleIapSettings AppleIap { get; set; } = new AppleIapSettings();
public class BaseServiceUriSettings
{
@ -219,5 +219,11 @@ namespace Bit.Core
public string ApplicationCacheTopicName { get; set; }
public string ApplicationCacheSubscriptionName { get; set; }
}
public class AppleIapSettings
{
public string Password { get; set; }
public bool AppInReview { get; set; }
}
}
}

View File

@ -40,7 +40,8 @@ namespace Bit.Core.Services
{
return null;
}
var validEnvironment = (!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") ||
var validEnvironment = _globalSettings.AppleIap.AppInReview ||
(!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") ||
(_hostingEnvironment.IsProduction() && receiptStatus.Environment != "Sandbox");
var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" ||
receiptStatus.Receipt.BundleId == "com.8bit.bitwarden";
@ -95,7 +96,7 @@ namespace Bit.Core.Services
var url = string.Format("https://{0}.itunes.apple.com/verifyReceipt", prod ? "buy" : "sandbox");
var json = new JObject(new JProperty("receipt-data", receiptData),
new JProperty("password", _globalSettings.AppleIapPassword)).ToString();
new JProperty("password", _globalSettings.AppleIap.Password)).ToString();
var response = await _httpClient.PostAsync(url, new StringContent(json));
if(response.IsSuccessStatusCode)