Skip to content

Alamofire Manager initialisation with Timberjack configuration and serverTrustPolicyManager not working #3

@andrewjackman

Description

@andrewjackman

I'm having a problem integrating this with my custom Alamofire Manager. I currently construct the Manager like this:

private let manager = Alamofire.Manager(serverTrustPolicyManager: ServerTrustPolicyManager(policies: [
    "api.example.com": .PerformDefaultEvaluation(validateHost: true),
    "dev.api.example.com": .PerformDefaultEvaluation(validateHost: false),
    "staging.api.example.com": .PerformDefaultEvaluation(validateHost: false)
]))

and my wildcard SSL certificate hostname verification is ignored on the dev.api and staging.api subdomains.

As soon as I add the configuration to support Timberjack logging to the Manager.init like this:

private let manager = Alamofire.Manager(configuration: Timberjack.defaultSessionConfiguration(), serverTrustPolicyManager: ServerTrustPolicyManager(policies: [
    "api.example.com": .PerformDefaultEvaluation(validateHost: true),
    "dev.api.example.com": .PerformDefaultEvaluation(validateHost: false),
    "staging.api.example.com": .PerformDefaultEvaluation(validateHost: false)
]))

the default serverTrustPolicyManager seems to be used, and my SSL handshake with dev.api and staging.api fail, because they don't match the *.example.com SSL certificate hostname. It's like something is overwriting my ServerTrustPolicyManager.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions