forked from loafle/openapi-generator-original
Merge pull request #3893 from 0xced/objc-no-custom-security-policy
[objc] Remove the custom security policy
This commit is contained in:
commit
a70321e47f
@ -80,7 +80,6 @@ static NSString * {{classPrefix}}__fileNameForResponse(NSURLResponse *response)
|
|||||||
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
|
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
|
||||||
@"multipart/form-data": afhttpRequestSerializer
|
@"multipart/form-data": afhttpRequestSerializer
|
||||||
};
|
};
|
||||||
self.securityPolicy = [self createSecurityPolicy];
|
|
||||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -352,25 +351,4 @@ static NSString * {{classPrefix}}__fileNameForResponse(NSURLResponse *response)
|
|||||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (AFSecurityPolicy *) createSecurityPolicy {
|
|
||||||
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
|
|
||||||
|
|
||||||
id<{{classPrefix}}Configuration> config = self.configuration;
|
|
||||||
|
|
||||||
if (config.sslCaCert) {
|
|
||||||
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
|
|
||||||
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.verifySSL) {
|
|
||||||
[securityPolicy setAllowInvalidCertificates:NO];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
[securityPolicy setAllowInvalidCertificates:YES];
|
|
||||||
[securityPolicy setValidatesDomainName:NO];
|
|
||||||
}
|
|
||||||
|
|
||||||
return securityPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -53,18 +53,6 @@ static NSString * const k{{classPrefix}}APIVersion = @"{{podVersion}}";
|
|||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic) BOOL debug;
|
@property (readonly, nonatomic) BOOL debug;
|
||||||
|
|
||||||
/**
|
|
||||||
* SSL/TLS verification
|
|
||||||
* Set this to NO to skip verifying SSL certificate when calling API from https server
|
|
||||||
*/
|
|
||||||
@property (readonly, nonatomic) BOOL verifySSL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SSL/TLS verification
|
|
||||||
* Set this to customize the certificate file to verify the peer
|
|
||||||
*/
|
|
||||||
@property (readonly, nonatomic) NSString *sslCaCert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authentication Settings
|
* Authentication Settings
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
_username = @"";
|
_username = @"";
|
||||||
_password = @"";
|
_password = @"";
|
||||||
_accessToken= @"";
|
_accessToken= @"";
|
||||||
_verifySSL = YES;
|
|
||||||
_mutableApiKey = [NSMutableDictionary dictionary];
|
_mutableApiKey = [NSMutableDictionary dictionary];
|
||||||
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
|
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
|
||||||
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
|
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
|
||||||
|
@ -80,7 +80,6 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
|
|||||||
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
|
@"application/x-www-form-urlencoded": afhttpRequestSerializer,
|
||||||
@"multipart/form-data": afhttpRequestSerializer
|
@"multipart/form-data": afhttpRequestSerializer
|
||||||
};
|
};
|
||||||
self.securityPolicy = [self createSecurityPolicy];
|
|
||||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -352,25 +351,4 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) {
|
|||||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (AFSecurityPolicy *) createSecurityPolicy {
|
|
||||||
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
|
|
||||||
|
|
||||||
id<SWGConfiguration> config = self.configuration;
|
|
||||||
|
|
||||||
if (config.sslCaCert) {
|
|
||||||
NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert];
|
|
||||||
[securityPolicy setPinnedCertificates:[NSSet setWithObject:certData]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.verifySSL) {
|
|
||||||
[securityPolicy setAllowInvalidCertificates:NO];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
[securityPolicy setAllowInvalidCertificates:YES];
|
|
||||||
[securityPolicy setValidatesDomainName:NO];
|
|
||||||
}
|
|
||||||
|
|
||||||
return securityPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -75,18 +75,6 @@ static NSString * const kSWGAPIVersion = @"1.0.0";
|
|||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic) BOOL debug;
|
@property (readonly, nonatomic) BOOL debug;
|
||||||
|
|
||||||
/**
|
|
||||||
* SSL/TLS verification
|
|
||||||
* Set this to NO to skip verifying SSL certificate when calling API from https server
|
|
||||||
*/
|
|
||||||
@property (readonly, nonatomic) BOOL verifySSL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SSL/TLS verification
|
|
||||||
* Set this to customize the certificate file to verify the peer
|
|
||||||
*/
|
|
||||||
@property (readonly, nonatomic) NSString *sslCaCert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authentication Settings
|
* Authentication Settings
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
_username = @"";
|
_username = @"";
|
||||||
_password = @"";
|
_password = @"";
|
||||||
_accessToken= @"";
|
_accessToken= @"";
|
||||||
_verifySSL = YES;
|
|
||||||
_mutableApiKey = [NSMutableDictionary dictionary];
|
_mutableApiKey = [NSMutableDictionary dictionary];
|
||||||
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
|
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
|
||||||
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
|
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user