summaryrefslogtreecommitdiff
path: root/app/src/production/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-01-04 13:23:58 +0100
committercyBerta <cyberta@riseup.net>2018-01-04 13:23:58 +0100
commit81a732702f7b3125ac543f92d8a5ec33cce972fe (patch)
tree26cec1d4d553e84abe29dd030b2c59e32f6aa2ef /app/src/production/java
parent67c375afcd7d2e62cdf761f4934860938ae29235 (diff)
8773 preseeded providers implementation for insecure flavor
Diffstat (limited to 'app/src/production/java')
-rw-r--r--app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java14
-rw-r--r--app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java42
2 files changed, 2 insertions, 54 deletions
diff --git a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java
index 363fa66c..3f05b0a2 100644
--- a/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/app/src/production/java/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -102,18 +102,4 @@ public class ConfigurationWizard extends BaseConfigurationWizard {
}
}
- @Override
- public void updateProviderDetails() {
- mConfigState.setAction(SETTING_UP_PROVIDER);
- Intent provider_API_command = new Intent(this, ProviderAPI.class);
-
- provider_API_command.setAction(ProviderAPI.UPDATE_PROVIDER_DETAILS);
- provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
- Bundle parameters = new Bundle();
- parameters.putString(Provider.MAIN_URL, selected_provider.getMainUrl().toString());
- provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters);
-
- startService(provider_API_command);
- }
-
}
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
index b27c3dca..39651a43 100644
--- a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -62,6 +62,7 @@ public class ProviderAPI extends ProviderApiBase {
lastProviderMainUrl = task.containsKey(Provider.MAIN_URL) ?
task.getString(Provider.MAIN_URL) :
"";
+ //TODO: remove that
providerCaCertFingerprint = task.containsKey(Provider.CA_CERT_FINGERPRINT) ?
task.getString(Provider.CA_CERT_FINGERPRINT) :
"";
@@ -119,43 +120,6 @@ public class ProviderAPI extends ProviderApiBase {
}
- private Bundle validateProviderDetails() {
- Bundle result = validateCertificateForProvider(providerCaCert, providerDefinition, lastProviderMainUrl);
-
- //invalid certificate or no certificate
- if (result.containsKey(ERRORS) || (result.containsKey(RESULT_KEY) && !result.getBoolean(RESULT_KEY)) ) {
- return result;
- }
-
- //valid certificate: skip download, save loaded provider CA cert and provider definition directly
- try {
- preferences.edit().putString(Provider.KEY, providerDefinition.toString()).
- putBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS)).
- putBoolean(Constants.PROVIDER_ALLOWED_REGISTERED, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOWED_REGISTERED)).
- putString(Provider.CA_CERT, providerCaCert).commit();
- CA_CERT_DOWNLOADED = true;
- PROVIDER_JSON_DOWNLOADED = true;
- result.putBoolean(RESULT_KEY, true);
- } catch (JSONException e) {
- e.printStackTrace();
- result.putBoolean(RESULT_KEY, false);
- result = setErrorResult(result, getString(R.string.warning_corrupted_provider_details), ERROR_CORRUPTED_PROVIDER_JSON.toString());
- }
-
- return result;
- }
-
- private void checkPersistedProviderUpdates() {
- String providerDomain = getProviderDomain(providerDefinition);
- if (hasUpdatedProviderDetails(providerDomain)) {
- providerCaCert = getPersistedProviderCA(providerDomain);
- providerDefinition = getPersistedProviderDefinition(providerDomain);
- providerCaCertFingerprint = getPersistedCaCertFingerprint(providerDomain);
- providerApiUrl = getApiUrlWithVersion(providerDefinition);
- }
- }
-
-
private Bundle getAndSetProviderJson(String providerMainUrl, String caCert, JSONObject providerDefinition) {
Bundle result = new Bundle();
@@ -186,7 +150,6 @@ public class ProviderAPI extends ProviderApiBase {
putString(Provider.KEY + "." + providerDomain, providerJson.toString()).commit();
result.putBoolean(RESULT_KEY, true);
} catch (JSONException e) {
- //TODO Error message should be contained in that provider_dot_json_string
String reason_to_fail = pickErrorMessage(providerDotJsonString);
result.putString(ERRORS, reason_to_fail);
result.putBoolean(RESULT_KEY, false);
@@ -261,7 +224,6 @@ public class ProviderAPI extends ProviderApiBase {
String providerDomain = providerJson.getString(Provider.DOMAIN);
String cert_string = downloadWithCommercialCA(caCertUrl);
- result.putBoolean(RESULT_KEY, true);
if (validCertificate(cert_string) && go_ahead) {
preferences.edit().putString(Provider.CA_CERT, cert_string).commit();
@@ -321,7 +283,7 @@ public class ProviderAPI extends ProviderApiBase {
*
* @return an empty string if it fails, the response body if not.
*/
- protected String downloadFromApiUrlWithProviderCA(String path, String caCert, JSONObject providerDefinition) {
+ private String downloadFromApiUrlWithProviderCA(String path, String caCert, JSONObject providerDefinition) {
String responseString;
JSONObject errorJson = new JSONObject();
String baseUrl = getApiUrl(providerDefinition);