1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-20 11:04:31 -05: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 DisableUserRegistration { get; set; }
public virtual bool DisableEmailNewDevice { get; set; } public virtual bool DisableEmailNewDevice { get; set; }
public virtual int OrganizationInviteExpirationHours { get; set; } = 120; // 5 days 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 InstallationSettings Installation { get; set; } = new InstallationSettings();
public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings(); public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings();
public virtual SqlSettings SqlServer { get; set; } = new SqlSettings(); 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 BitPaySettings BitPay { get; set; } = new BitPaySettings();
public virtual AmazonSettings Amazon { get; set; } = new AmazonSettings(); public virtual AmazonSettings Amazon { get; set; } = new AmazonSettings();
public virtual ServiceBusSettings ServiceBus { get; set; } = new ServiceBusSettings(); public virtual ServiceBusSettings ServiceBus { get; set; } = new ServiceBusSettings();
public virtual AppleIapSettings AppleIap { get; set; } = new AppleIapSettings();
public class BaseServiceUriSettings public class BaseServiceUriSettings
{ {
@ -219,5 +219,11 @@ namespace Bit.Core
public string ApplicationCacheTopicName { get; set; } public string ApplicationCacheTopicName { get; set; }
public string ApplicationCacheSubscriptionName { 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; return null;
} }
var validEnvironment = (!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") || var validEnvironment = _globalSettings.AppleIap.AppInReview ||
(!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") ||
(_hostingEnvironment.IsProduction() && receiptStatus.Environment != "Sandbox"); (_hostingEnvironment.IsProduction() && receiptStatus.Environment != "Sandbox");
var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" || var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" ||
receiptStatus.Receipt.BundleId == "com.8bit.bitwarden"; 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 url = string.Format("https://{0}.itunes.apple.com/verifyReceipt", prod ? "buy" : "sandbox");
var json = new JObject(new JProperty("receipt-data", receiptData), 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)); var response = await _httpClient.PostAsync(url, new StringContent(json));
if(response.IsSuccessStatusCode) if(response.IsSuccessStatusCode)