ServerTrustPolicyManager
open class ServerTrustPolicyManager
Responsible for managing the mapping of ServerTrustPolicy objects to a given host.
-
The dictionary of policies mapped to a particular host.
Declaration
Swift
public let policies: [String : ServerTrustPolicy] -
Initializes the
ServerTrustPolicyManagerinstance with the given policies.Since different servers and web services can have different leaf certificates, intermediate and even root certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key pinning for host3 and disabling evaluation for host4.
Declaration
Swift
public init(policies: [String : ServerTrustPolicy])Parameters
policiesA dictionary of all policies mapped to a particular host.
Return Value
The new
ServerTrustPolicyManagerinstance. -
Returns the
ServerTrustPolicyfor the given host if applicable.By default, this method will return the policy that perfectly matches the given host. Subclasses could override this method and implement more complex mapping implementations such as wildcards.
Declaration
Swift
open func serverTrustPolicy(forHost host: String) -> ServerTrustPolicy?Parameters
hostThe host to use when searching for a matching policy.
Return Value
The server trust policy for the given host if found.
ServerTrustPolicyManager Class Reference