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 ofOTPAuthenticationParameters
in theOnboardingContext
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 aOTPAuthenticationParameters
instance in theOnboardingContext
.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.
-
This function runs when the Onboarding step is initialized and there is no previous context data
Declaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
receives an OnboardingContext object
completionHandler
when everything is done, this should be called
-
This function runs when there was a previou Onboarding step and that is restored
Declaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
receives an OnboardingContext object
completionHandler
when everything is done, this should be called
-
resetPasscode function with
OnboardingContext
supportDeclaration
Swift
open func resetPasscode(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Step OnboardingResult filled.
-
This function resets the modifications of the OTPSessionConfigurationStep in the SAPURLSession.
Declaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)
Parameters
context
OnboardingContext object, where the reset should be applied
completionHandler
completion which should be called after reset