I searched all over the world and could not find the answer to my question. To make our application more secure, we were told to use "certificate commit". We already use the Alamofire library for all our API calls, so it seems natural to use it ServerTrustPolicyManager, included as a means to implement certificate enforcing. I have included the appropriate certificates in my application package, and here is the code I use to configure mine SessionManagerfor Alamofire:
let url = "https://www.mycompany.com"
var manager: SessionManager? {
let serverTrustPolicy = ServerTrustPolicy.pinCertificates(
certificates: ServerTrustPolicy.certificates(),
validateCertificateChain: true,
validateHost: true
)
let serverTrustPolicies: [String: ServerTrustPolicy] = [
url: serverTrustPolicy
]
let config = URLSessionConfiguration.default
return SessionManager(configuration: config, serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies))
}
Now that I want to make an API request, I have this method:
func request(routerRequest request: URLRequestConvertible) -> DataRequest {
assert(url != "", "A base URL string must be set in order to make request")
print("URL: \(url) : \(request)")
return (manager ?? SessionManager.default).request(request)
}
, , , , - Charles Proxy... . , - - Charles , ?
, , - ( ) . , Uber Wells Fargo, , , , - " , ssl " ( ).
, , SessionManager. , , , , . - ? ?
. !