CLASS
HaapiConfiguration
Contents
- Properties
nameclientIdbaseURLtokenEndpointURLauthorizationEndpointURLappRedirecthttpHeadersProviderisAutoRedirecturlSessionrevocationEndpointURLauthorizationParametersProviderminTokenTtlattestationConfigurationtokenBoundConfigurationtokenEndpointResponseListenerclientAuthenticationMethodriskAssessmentConfigurationstorageallowInsecureHttpEndpoints
- Methods
init(name:clientId:baseURL:tokenEndpointURL:authorizationEndpointURL:appRedirect:httpHeadersProvider:authorizationParametersProvider:isAutoRedirect:urlSession:revocationEndpointURL:minTokenTtl:attestationConfiguration:tokenBoundConfiguration:tokenEndpointResponseListener:clientAuthenticationMethod:riskAssessmentConfiguration:storage:)init(name:clientId:baseURL:tokenEndpointURL:authorizationEndpointURL:appRedirect:httpHeadersProvider:authorizationParametersProvider:isAutoRedirect:urlSession:revocationEndpointURL:minTokenTtl:attestationConfiguration:tokenBoundConfiguration:tokenEndpointResponseListener:clientAuthenticationMethod:riskAssessmentConfiguration:storage:allowInsecureHttpEndpoints:)
@objcMembers public final class HaapiConfiguration: NSObject, HaapiConfigurable, OAuthTokenConfigurable,
StorageProviding, InsecureEndpointsPermitting
Configuration options for the library.
Properties
name
public let name: String
clientId
public let clientId: String
baseURL
public let baseURL: URL
tokenEndpointURL
public let tokenEndpointURL: URL
authorizationEndpointURL
public let authorizationEndpointURL: URL
appRedirect
public let appRedirect: String
httpHeadersProvider
public let httpHeadersProvider: HttpHeadersProvider?
isAutoRedirect
public let isAutoRedirect: Bool
urlSession
public let urlSession: URLSession
revocationEndpointURL
public let revocationEndpointURL: URL?
authorizationParametersProvider
public let authorizationParametersProvider: OAuthAuthorizationParametersProvider?
minTokenTtl
public let minTokenTtl: TimeInterval
attestationConfiguration
public let attestationConfiguration: AttestationConfiguration
tokenBoundConfiguration
public let tokenBoundConfiguration: TokenBoundConfiguration
tokenEndpointResponseListener
public let tokenEndpointResponseListener: (any OAuthTokenManager.TokenEndpointResponseListener)?
clientAuthenticationMethod
public let clientAuthenticationMethod: ClientAuthenticationMethod
riskAssessmentConfiguration
public let riskAssessmentConfiguration: RiskAssessmentConfiguration?
storage
@nonobjc public let storage: Storage
Where the SDK persists its stored credentials (token/DPoP session state and DCR data). Inject a
Storage to choose the backend; defaults to the app-private keychain
(StorageBuilder.Keychain().build()), unchanged from previous SDK versions. DCR data inherits
this storage unless DCRConfiguration is given its own.
allowInsecureHttpEndpoints
public let allowInsecureHttpEndpoints: Bool
Whether the identity server may be addressed over plain http. false unless the configuration was created
with allowInsecureHttpEndpoints: true: creating a HaapiManager or an accessor fails when the base URL,
the authorization endpoint, the token endpoint, the revocation endpoint or — when dynamic client registration
is configured — the registration endpoint does not use https.
true only permits an http address to be configured; any other scheme, or none, is still refused. App
Transport Security still decides whether the app may send cleartext traffic, and a request is still only sent
to a configured address. Intended for a local development or test server; leave it false in production. Only
a HaapiConfiguration can permit it: any other HaapiConfigurable type requires https.
Methods
init(name:clientId:baseURL:tokenEndpointURL:authorizationEndpointURL:appRedirect:httpHeadersProvider:authorizationParametersProvider:isAutoRedirect:urlSession:revocationEndpointURL:minTokenTtl:attestationConfiguration:tokenBoundConfiguration:tokenEndpointResponseListener:clientAuthenticationMethod:riskAssessmentConfiguration:storage:)
public convenience init(
name: String,
clientId: String,
baseURL: URL,
tokenEndpointURL: URL,
authorizationEndpointURL: URL,
appRedirect: String,
httpHeadersProvider: HttpHeadersProvider?,
authorizationParametersProvider: OAuthAuthorizationParametersProvider?,
isAutoRedirect: Bool = true,
urlSession: URLSession = URLSession(configuration: .haapi),
revocationEndpointURL: URL? = nil,
minTokenTtl: TimeInterval = TimeInterval(floatLiteral: 10.0),
attestationConfiguration: AttestationConfiguration = AttestationConfiguration(),
tokenBoundConfiguration: TokenBoundConfiguration = UnboundedTokenConfiguration(),
tokenEndpointResponseListener: (any OAuthTokenManager.TokenEndpointResponseListener)? = nil,
clientAuthenticationMethod: ClientAuthenticationMethod = ClientAuthenticationMethodNone(),
riskAssessmentConfiguration: RiskAssessmentConfiguration? = nil,
storage: Storage = StorageBuilder.Keychain().build()
)
Creates a HaapiConfiguration with the specified parmeters.
- Parameters:
- name: The name of the configuration. Only one open
HaapiManagermay use a name at a time; creating another throwsHaapiError.haapiTokenManagerAlreadyExistsuntil the first is closed. - clientId: The client ID as configured in the Curity Identity Server. configuration.
- baseURL: The base
URLof the Curity Identity Server. Used to resolve relative links. Not the issuer ID. WithauthorizationEndpointURL, the only address a HAAPI request may target (scheme and host); a followed link must target this address. - tokenEndpointURL: The token endpoint URL.
- authorizationEndpointURL: The authorization endpoint URL. With
baseURL, the only address a HAAPI request may target (scheme and host). - appRedirect: The client application's redirect URI, used in authorization requests. (Deep link)
- httpHeadersProvider: An optional closure that produces the headers parameters that will be used when haapi endpoints.
- authorizationParametersProvider: An optional closure that produces the authorization parameters to send in Authorization requests.
- isAutoRedirect: Whether
HaapiManagerwill automatically follow redirection steps. By default, the value istrue. - urlSession: The
URLSessionthat is used to perform network requests. By default, the value isURLSessionConfiguration.haapi. - revocationEndpointURL: The token revocation endpoint URL.
- minTokenTtl: The minimum TTL a token must have to be able to be used in a request. By default, the value is 10 seconds.
- attestationConfiguration: Configures the
DeviceCheckattestation mechanism. By default, attestation is enabled and max retries is 3. - tokenBoundConfiguration: Configures the Token Endpoint
Dpopbinding mechanism behaviour for the client configuration. The default value isUnboundedTokenConfiguration. - tokenEndpointResponseListener: The listener to notify when receiving a response from the token endpoint. The default value is
nil. - clientAuthenticationMethod: The client authentication method configuration to use. By default, it is set to
ClientAuthenticationMethodConfigurationNone. - riskAssessmentConfiguration: The configuration object that provides device and app information for risk assessment purposes. When the client configuration for
Haapiintegrates theBankIDservices with the risk assessment feature, theRiskAssessmentConfigurationis required to enable collection of contextual information about the device.
- name: The name of the configuration. Only one open
- Note: Equivalent to the initializer that takes
allowInsecureHttpEndpoints, withfalse: the base URL, the authorization endpoint, the token endpoint, a revocation endpoint and a dynamic client registration endpoint must usehttps. A candidate for deprecation in the next major version, in favour of that initializer.
Parameters
| Name | Description |
|---|---|
| name | The name of the configuration. Only one open HaapiManager may use a name at a time; creating another throws HaapiError.haapiTokenManagerAlreadyExists until the first is closed. |
| clientId | The client ID as configured in the Curity Identity Server. configuration. |
| baseURL | The base URL of the Curity Identity Server. Used to resolve relative links. Not the issuer ID. With authorizationEndpointURL, the only address a HAAPI request may target (scheme and host); a followed link must target this address. |
| tokenEndpointURL | The token endpoint URL. |
| authorizationEndpointURL | The authorization endpoint URL. With baseURL, the only address a HAAPI request may target (scheme and host). |
| appRedirect | The client application’s redirect URI, used in authorization requests. (Deep link) |
| httpHeadersProvider | An optional closure that produces the headers parameters that will be used when haapi endpoints. |
| authorizationParametersProvider | An optional closure that produces the authorization parameters to send in Authorization requests. |
| isAutoRedirect | Whether HaapiManager will automatically follow redirection steps. By default, the value is true. |
| urlSession | The URLSession that is used to perform network requests. By default, the value is URLSessionConfiguration.haapi. |
| revocationEndpointURL | The token revocation endpoint URL. |
| minTokenTtl | The minimum TTL a token must have to be able to be used in a request. By default, the value is 10 seconds. |
| attestationConfiguration | Configures the DeviceCheck attestation mechanism. By default, attestation is enabled and max retries is 3. |
| tokenBoundConfiguration | Configures the Token Endpoint Dpop binding mechanism behaviour for the client configuration. The default value is UnboundedTokenConfiguration. |
| tokenEndpointResponseListener | The listener to notify when receiving a response from the token endpoint. The default value is nil. |
| clientAuthenticationMethod | The client authentication method configuration to use. By default, it is set to ClientAuthenticationMethodConfigurationNone. |
| riskAssessmentConfiguration | The configuration object that provides device and app information for risk assessment purposes. When the client configuration for Haapi integrates the BankID services with the risk assessment feature, the RiskAssessmentConfiguration is required to enable collection of contextual information about the device. |
init(name:clientId:baseURL:tokenEndpointURL:authorizationEndpointURL:appRedirect:httpHeadersProvider:authorizationParametersProvider:isAutoRedirect:urlSession:revocationEndpointURL:minTokenTtl:attestationConfiguration:tokenBoundConfiguration:tokenEndpointResponseListener:clientAuthenticationMethod:riskAssessmentConfiguration:storage:allowInsecureHttpEndpoints:)
public init(
name: String,
clientId: String,
baseURL: URL,
tokenEndpointURL: URL,
authorizationEndpointURL: URL,
appRedirect: String,
httpHeadersProvider: HttpHeadersProvider?,
authorizationParametersProvider: OAuthAuthorizationParametersProvider?,
isAutoRedirect: Bool = true,
urlSession: URLSession = URLSession(configuration: .haapi),
revocationEndpointURL: URL? = nil,
minTokenTtl: TimeInterval = TimeInterval(floatLiteral: 10.0),
attestationConfiguration: AttestationConfiguration = AttestationConfiguration(),
tokenBoundConfiguration: TokenBoundConfiguration = UnboundedTokenConfiguration(),
tokenEndpointResponseListener: (any OAuthTokenManager.TokenEndpointResponseListener)? = nil,
clientAuthenticationMethod: ClientAuthenticationMethod = ClientAuthenticationMethodNone(),
riskAssessmentConfiguration: RiskAssessmentConfiguration? = nil,
// The flag comes last and has no default: that is what keeps this initializer distinct from the one
// without it, so a call that omits it still resolves to the unchanged initializer.
// swiftlint:disable:next function_default_parameter_at_end
storage: Storage = StorageBuilder.Keychain().build(),
allowInsecureHttpEndpoints: Bool
)
Creates a HaapiConfiguration that states whether the identity server may be addressed over plain http.
Every other parameter, and its default, is that of the initializer without allowInsecureHttpEndpoints.
- Parameters:
- name: The name of the configuration. Only one open
HaapiManagermay use a name at a time; creating another throwsHaapiError.haapiTokenManagerAlreadyExistsuntil the first is closed. - clientId: The client ID as configured in the Curity Identity Server.
- baseURL: The base
URLof the Curity Identity Server. Used to resolve relative links. Not the issuer ID. WithauthorizationEndpointURL, the only address a HAAPI request may target (scheme and host); a followed link must target this address. - tokenEndpointURL: The token endpoint URL.
- authorizationEndpointURL: The authorization endpoint URL. With
baseURL, the only address a HAAPI request may target (scheme and host). - appRedirect: The client application's redirect URI, used in authorization requests. (Deep link)
- httpHeadersProvider: An optional closure that produces the headers parameters that will be used when haapi endpoints.
- authorizationParametersProvider: An optional closure that produces the authorization parameters to send in Authorization requests.
- isAutoRedirect: Whether
HaapiManagerwill automatically follow redirection steps. By default, the value istrue. - urlSession: The
URLSessionthat is used to perform network requests. By default, the value isURLSessionConfiguration.haapi. - revocationEndpointURL: The token revocation endpoint URL.
- minTokenTtl: The minimum TTL a token must have to be able to be used in a request. By default, the value is 10 seconds.
- attestationConfiguration: Configures the
DeviceCheckattestation mechanism. By default, attestation is enabled and max retries is 3. - tokenBoundConfiguration: Configures the Token Endpoint
Dpopbinding mechanism behaviour for the client configuration. The default value isUnboundedTokenConfiguration. - tokenEndpointResponseListener: The listener to notify when receiving a response from the token endpoint. The default value is
nil. - clientAuthenticationMethod: The client authentication method configuration to use. By default, it is set to
ClientAuthenticationMethodNone(). - riskAssessmentConfiguration: The configuration object that provides device and app information for risk assessment purposes.
- storage: Where the SDK persists its stored credentials. Defaults to the app-private keychain.
- allowInsecureHttpEndpoints: Whether the base URL, the authorization endpoint, the token endpoint, a revocation endpoint and a dynamic client registration endpoint may use plain
http. Passfalseto requirehttps, which is what the initializer without this parameter does.trueonly permits anhttpaddress to be configured — any other scheme is still refused — while App Transport Security still governs cleartext traffic, and a request is still only sent to a configured address. Intended for a local development or test server.
- name: The name of the configuration. Only one open
Parameters
| Name | Description |
|---|---|
| name | The name of the configuration. Only one open HaapiManager may use a name at a time; creating another throws HaapiError.haapiTokenManagerAlreadyExists until the first is closed. |
| clientId | The client ID as configured in the Curity Identity Server. |
| baseURL | The base URL of the Curity Identity Server. Used to resolve relative links. Not the issuer ID. With authorizationEndpointURL, the only address a HAAPI request may target (scheme and host); a followed link must target this address. |
| tokenEndpointURL | The token endpoint URL. |
| authorizationEndpointURL | The authorization endpoint URL. With baseURL, the only address a HAAPI request may target (scheme and host). |
| appRedirect | The client application’s redirect URI, used in authorization requests. (Deep link) |
| httpHeadersProvider | An optional closure that produces the headers parameters that will be used when haapi endpoints. |
| authorizationParametersProvider | An optional closure that produces the authorization parameters to send in Authorization requests. |
| isAutoRedirect | Whether HaapiManager will automatically follow redirection steps. By default, the value is true. |
| urlSession | The URLSession that is used to perform network requests. By default, the value is URLSessionConfiguration.haapi. |
| revocationEndpointURL | The token revocation endpoint URL. |
| minTokenTtl | The minimum TTL a token must have to be able to be used in a request. By default, the value is 10 seconds. |
| attestationConfiguration | Configures the DeviceCheck attestation mechanism. By default, attestation is enabled and max retries is 3. |
| tokenBoundConfiguration | Configures the Token Endpoint Dpop binding mechanism behaviour for the client configuration. The default value is UnboundedTokenConfiguration. |
| tokenEndpointResponseListener | The listener to notify when receiving a response from the token endpoint. The default value is nil. |
| clientAuthenticationMethod | The client authentication method configuration to use. By default, it is set to ClientAuthenticationMethodNone(). |
| riskAssessmentConfiguration | The configuration object that provides device and app information for risk assessment purposes. |
| storage | Where the SDK persists its stored credentials. Defaults to the app-private keychain. |
| allowInsecureHttpEndpoints | Whether the base URL, the authorization endpoint, the token endpoint, a revocation endpoint and a dynamic client registration endpoint may use plain http. Pass false to require https, which is what the initializer without this parameter does. true only permits an http address to be configured — any other scheme is still refused — while App Transport Security still governs cleartext traffic, and a request is still only sent to a configured address. Intended for a local development or test server. |