APIKeyAuthenticationStep

open class APIKeyAuthenticationStep : OnboardingStep

Onboarding step implementation of APIKey Authentication Used in the onboarding/restoring flow, this step is responsible to configure the app’s URLSession to be able to communicate with apikey authentication protected resources. Creates and registers the APIKeyAuthenticationObserver to the SAPURLSession, then sends a validation request.

  • Tells the authentication step whether offline restore should be supported. If the property is true, the authentication step gracefully handles network conditions when restoring while offline. By default this property is true.

    Declaration

    Swift

    public var isAllowingOfflineRestore: Bool
  • Designated initializer

    Declaration

    Swift

    public init()
  • Undocumented

    Declaration

    Swift

    public init(config: APIKeyAuthenticationConfig?)
  • Onboards to the given URL

    Declaration

    Swift

    open func onboard(sapURLSession: SAPURLSession, validationURL: URL, apikeyAuthConfig: APIKeyAuthenticationConfig, completionHandler: @escaping (Error?) -> Void)

    Parameters

    sapURLSession

    SAPURLSession that handle the connection to the authenticationURL

    validationURL

    resource URL that is used for auth validation

    apikeyAuthConfig

    APIKeyAuthenticationConfigto be used for apikey authentication

    completionHandler

    called when the process finished. Error filled on failure.

  • Restore the previous state of onboarding

    Declaration

    Swift

    open func restore(sapURLSession: SAPURLSession, validationURL: URL, apikeyAuthConfig: APIKeyAuthenticationConfig, completionHandler: @escaping (Error?) -> Void)

    Parameters

    sapURLSession

    SAPURLSession that handle the connection to the authenticationURL

    validationURL

    resource URL that is used for auth validation

    apikeyAuthConfig

    APIKeyAuthenticationConfigto be used for apikey authentication

    completionHandler

    called when the process finished. Error filled on failure.

  • Resets the modifications of step

    Declaration

    Swift

    open func reset(sapURLSession: SAPURLSession, completionHandler: @escaping () -> Void)

    Parameters

    sapURLSession

    SAPURLSession on which the apikey authentication observer has to be removed

    completionHandler

    called when the process finished.

  • This method creates the APIKeyAuthenticationObserver instance used on the SAPURLSession in the OnboardingContext. The step user may override this method to supply a custom APIKeyAuthenticationObserver.

    Declaration

    Swift

    open func createAPIKeyAuthenticationObserver(apiKeyCredentialDiscovery: APIKeyCredentialDiscovery, isAPIKeyAccessOnlySecConfig: Bool) -> APIKeyAuthenticationObserver

    Parameters

    apiKeyCredentialDiscovery
    isAPIKeyAccessOnlySecConfig

    The flag that should be set to true for API Key Access Only security configuration, else false.

    Return Value

    An instance of the BasicAuthenticationObserver.