class Xcadaptor::ConfigModule::Sll
Public Class Methods
exceptionDomains(is_black)
click to toggle source
# 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)
click to toggle source
config ssl. wihte_domains is ssl. otherwise block_domains
# 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