blob: 2436cbf3e87d7e83c4470c4a56dd60c55cecf12a (
plain)
1
2
3
4
5
6
7
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
//
// RESTProxyFactory.swift
// MullvadREST
//
// Created by pronebird on 19/04/2022.
// Copyright © 2022 Mullvad VPN AB. All rights reserved.
//
import Foundation
extension REST {
public final class ProxyFactory {
public let configuration: AuthProxyConfiguration
public class func makeProxyFactory(
transportProvider: RESTTransportProvider,
addressCache: AddressCache
) -> ProxyFactory {
let basicConfiguration = REST.ProxyConfiguration(
transportProvider: transportProvider,
addressCacheStore: addressCache
)
let authenticationProxy = REST.AuthenticationProxy(
configuration: basicConfiguration
)
let accessTokenManager = REST.AccessTokenManager(
authenticationProxy: authenticationProxy
)
let authConfiguration = REST.AuthProxyConfiguration(
proxyConfiguration: basicConfiguration,
accessTokenManager: accessTokenManager
)
return ProxyFactory(configuration: authConfiguration)
}
public init(configuration: AuthProxyConfiguration) {
self.configuration = configuration
}
public func createAPIProxy() -> REST.APIProxy {
REST.APIProxy(configuration: configuration)
}
public func createAccountsProxy() -> REST.AccountsProxy {
REST.AccountsProxy(configuration: configuration)
}
public func createDevicesProxy() -> REST.DevicesProxy {
REST.DevicesProxy(configuration: configuration)
}
}
}
|