public class Builder
Builder is used to instantiate a
HaapiTokenManager with the settings
that are appropriate for your environment by using the Builder pattern.
An example use of the
Builder to create a default
HaapiTokenManager could look like this:
let urlSession = URLSession(configuration: configuration, delegate: trustAllCertsDelegate, delegateQueue: nil) haapiTokenManager = HaapiTokenManager.Builder( tokenEndpoint: "https://my.curity.example.com/oauth/token", clientId: "my-haapi-client" ) .setInternalUrlSession(urlSession) .build()
public init (tokenEndpoint: URL, clientId: String)
Builder with the mandatory
public func setName(_ name: String) -> Builder
Set a name for the
HaapiTokenManager. The name is used as prefix in identifying the storage location where the
HaapiTokenManager persists state.
When nothing is set, a default of "haapi" is used as name.
You can not use two
HaapiTokenManager instances with the same name.
public func setStorage(_ storage: Storage) -> Builder
Set the storage instance responsible for persisting state of the
HaapiTokenManager. When nothing is set, a Keychain storage manager will be used.
public func setInternalUrlSession(_ urlSession: URLSession) -> Builder
URLSession instance that is used to make requests to the HAAPI services (e.g. the token endpoint and the HAAPI-enabled endpoints of the server)
When nothing is set, a
URLSession with default settings is used.
public func setHaapiTokenMinTtl(_ minTtl: TimeInterval) -> Builder
Set the minimum time to live (in seconds) that the HAAPI Token must be valid for. If the token expires before then, the
HaapiTokenManager will try to refresh it.
When nothing is set, a value of 10 is used as minimum time to live
public func disableDeviceCheckAttestation() -> Builder
Allows the created
HaapiTokenManager to run on a similator by turning off
When the compilation target is a simulator,
DeviceCheck attestation/-assertion is automatically disabled.
This feature requires the server to be configured to have attestation validation disabled for this client.
public func build() -> HaapiTokenManager
Build a new
HaapiTokenManager instance from the state that is created inside the
This method can abort your application if the desired name for a
HaapiTokenManager already exists within the current context.