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 = FioriUIWebViewPresenter()
presenter.webViewControllerConfigurationHandler = { webView in
webView.cancelButton?.title = localizedCancelButtonText
return webView
}
let step = OTPSessionConfigurationStep(presenter: presenter)
step.infoScreenText = localizedInfoScreenText
return step
}
-
The
OnboardingInfoKeyassociated with an instance ofOTPAuthenticationParametersin theOnboardingContextinfo.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
WKWebViewinstance to authenticate.Declaration
Swift
public init(infoKey: OnboardingInfoKey = .otpParameters, webViewPresenter: WKWebViewPresenting & FlowPresentationDelegateClient = FioriWKWebViewPresenter())Parameters
infoKeyThe
OnboardingInfoKeywhich marks aOTPAuthenticationParametersinstance in theOnboardingContext.webViewPresenterThe web view presenter which will supply an
WKWebViewinstance. -
Creates an OTPAuthenticator
Declaration
Swift
open func createAuthenticator(otpParameters: OTPParameters, presentationDelegate: FlowPresentationDelegate) -> OTPAuthenticatorParameters
otpParametersOTPParameters
presentationDelegatepresenter 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
authenticationParametersreceives OTP parameters
sapURLSessionSAPURLSession type, the OTP observer has to be registered to this sapURLSession
presentationDelegatethe presentation delegate object
completionHandlerwhen 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
authenticationParametersreceives OTP parameters
sapURLSessionSAPURLSession type, the OTP observer has to be registered to this sapURLSession
presentationDelegatethe presentation delegate object
completionHandlerwhen 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
sapURLSessionSAPURLSessioncompletionHandlercalled 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
contextreceives an OnboardingContext object
completionHandlerwhen 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
contextreceives an OnboardingContext object
completionHandlerwhen everything is done, this should be called
-
resetPasscode function with
OnboardingContextsupportDeclaration
Swift
open func resetPasscode(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled 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
contextOnboardingContext object, where the reset should be applied
completionHandlercompletion which should be called after reset