Class: Xcadaptor::ConfigModule::Sll
- Inherits:
-
Object
- Object
- Xcadaptor::ConfigModule::Sll
- Defined in:
- lib/xcadaptor/Config/ssl.rb
Class Method Summary collapse
- .exceptionDomains(is_black) ⇒ Object
-
.run(black_domains = {}, white_domains = {}, is_force) ⇒ Object
config ssl.
Class Method Details
.exceptionDomains(is_black) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/xcadaptor/Config/ssl.rb', line 38 def self.exceptionDomains(is_black) { NSExceptionMinimumTLSVersion: "TLSV1.2", NSExceptionRequiresForwardSecrecy: true, NSExceptionAllowsInsecureHTTPLoads: is_black, NSIncludesSubdomains: true, } end |
.run(black_domains = {}, white_domains = {}, is_force) ⇒ Object
config ssl. wihte_domains is ssl. otherwise block_domains
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xcadaptor/Config/ssl.rb', line 8 def self.run(black_domains = {},white_domains = {},is_force) project =Xcadaptor::Project.new info_plist = project.info_plist ssl_key = "NSAppTransportSecurity" ssl_value = info_plist[ssl_key] if(ssl_value && !is_force) puts '[NSAppTransportSecurity] exsits. use --force to cover it' else domains_hash = {} black_domains.each do |domain| domains_hash[domain] = self.exceptionDomains(true) end white_domains.each do |domain| domains_hash[domain] = self.exceptionDomains(false) end info_plist[ssl_key] = { "NSAllowsArbitraryLoads" => true, "NSExceptionDomains" => domains_hash } puts "config NSAppTransportSecurity finished" project.save end end |