OTPSessionConfigurationStep

open class OTPSessionConfigurationStep : OnboardingStep

OTP onboarding step.

Used in the onboarding / restoring flow, this step is responsible to configure the app’s URLSession to be able to communicate with OTP protected resources. Creates and registers the OTPObserver. This step should be set before the authentication step (can be used with Basic, OAuth 2.0 and SAML 2.0 authentications).

Customization

During the onboarding flow, if there is a splash screen which shows a text, that text can be changed/localized. The presented webView will also have localizable components, but the localization of downloaded data depends on the server and is not customizable from the created client application.

func customOTPAuthStep() -> OnboardingStep {
   let otpBundle = Bundle(for: OTPSessionConfigurationStep.self)

   let localizedInfoScreenText = NSLocalizedString("OTPInfoScreenText", tableName: "Example Table name", bundle: otpBundle, value: "Validating OTP credentials", comment: "")
   let localizedCancelButtonText = NSLocalizedString("CancelButtonText", tableName: "Example Table name", bundle: otpBundle, value: "Cancel", comment: "")

   let presenter = FioriWKWebViewPresenter()
   presenter.webViewControllerConfigurationHandler = { webView in
       webView.cancelButton?.title = localizedCancelButtonText

       return webView
   }

   let step = OTPSessionConfigurationStep(presenter: presenter)
   step.infoScreenText = localizedInfoScreenText

   return step
}
  • The OnboardingInfoKey associated with an instance of OTPAuthenticationParameters in the OnboardingContext info.

    Declaration

    Swift

    public let infoKey: OnboardingInfoKey
  • The flow presentation delegate. This is a force-unwrapped property that needs to be injected before usage.

    Declaration

    Swift

    public var presenter: FlowPresentationDelegateClient!
  • Instantiates the OTP onboarding step. Will use a WKWebView instance to authenticate.

    Declaration

    Swift

    public init(infoKey: OnboardingInfoKey = .otpParameters, webViewPresenter: WKWebViewPresenting & FlowPresentationDelegateClient = FioriWKWebViewPresenter())

    Parameters

    infoKey

    The OnboardingInfoKey which marks a OTPAuthenticationParameters instance in the OnboardingContext.

    webViewPresenter

    The web view presenter which will supply an WKWebView instance.

  • Creates an OTPAuthenticator

    Declaration

    Swift

    open func createAuthenticator(otpParameters: OTPParameters, presentationDelegate: FlowPresentationDelegate) -> OTPAuthenticator

    Parameters

    otpParameters

    OTPParameters

    presentationDelegate

    presenter which presents the WebView

    Return Value

    OTPAuthenticator object

  • This function runs when the Onboarding step is initialized and there is no previous context data

    Declaration

    Swift

    open func onboard(otpParameters: OTPParameters, sapURLSession: SAPURLSession, presentationDelegate: FlowPresentationDelegate, completionHandler: @escaping (Error?) -> Void)

    Parameters

    authenticationParameters

    receives OTP parameters

    sapURLSession

    SAPURLSession type, the OTP observer has to be registered to this sapURLSession

    presentationDelegate

    the presentation delegate object

    completionHandler

    when everything is done, this should be called

  • This function runs when there was a previous Onboarding step and that is restored

    Declaration

    Swift

    open func restore(otpParameters: OTPParameters, sapURLSession: SAPURLSession, presentationDelegate: FlowPresentationDelegate, completionHandler: @escaping (Error?) -> Void)

    Parameters

    authenticationParameters

    receives OTP parameters

    sapURLSession

    SAPURLSession type, the OTP observer has to be registered to this sapURLSession

    presentationDelegate

    the presentation delegate object

    completionHandler

    when everything is done, this should be called

  • This function resets the modifications of the OTPSessionConfigurationStep in the SAPURLSession.

    Declaration

    Swift

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

    Parameters

    sapURLSession

    SAPURLSession

    completionHandler

    called when the process finished.