changed behaviour #29: removed "validateDomainName" function and disabling it when "acceptAllCerts" is enabled

This commit is contained in:
Sefa Ilkimen
2017-10-19 16:24:54 +02:00
parent c29ce85df3
commit a8f1d2b1c2
6 changed files with 20 additions and 26 deletions
@@ -99,11 +99,7 @@ public class CordovaHttpPlugin extends CordovaPlugin {
boolean accept = args.getBoolean(0);
CordovaHttp.acceptAllCerts(accept);
callbackContext.success();
} else if (action.equals("validateDomainName")) {
boolean accept = args.getBoolean(0);
CordovaHttp.validateDomainName(accept);
CordovaHttp.validateDomainName(!accept);
callbackContext.success();
} else if (action.equals("uploadFile")) {
String urlString = args.getString(0);
-1
View File
@@ -6,7 +6,6 @@
- (void)enableSSLPinning:(CDVInvokedUrlCommand*)command;
- (void)acceptAllCerts:(CDVInvokedUrlCommand*)command;
- (void)validateDomainName:(CDVInvokedUrlCommand*)command;
- (void)disableRedirect:(CDVInvokedUrlCommand*)command;
- (void)post:(CDVInvokedUrlCommand*)command;
- (void)get:(CDVInvokedUrlCommand*)command;
+2 -10
View File
@@ -108,6 +108,7 @@
- (void)enableSSLPinning:(CDVInvokedUrlCommand*)command {
bool enable = [[command.arguments objectAtIndex:0] boolValue];
if (enable) {
securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
} else {
@@ -133,16 +134,7 @@
bool allow = [[command.arguments objectAtIndex:0] boolValue];
securityPolicy.allowInvalidCertificates = allow;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)validateDomainName:(CDVInvokedUrlCommand*)command {
CDVPluginResult* pluginResult = nil;
bool validate = [[command.arguments objectAtIndex:0] boolValue];
securityPolicy.validatesDomainName = validate;
securityPolicy.validatesDomainName = !allow;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];