SLSAuthenticationStep
open class SLSAuthenticationStep : OnboardingStep
Onboarding step implementation of SLS certificate authentication Used in the onboarding/restoring flow, this step is responsible to configure the app’s URLSession to be able to communicate with SLS authentication protected resources. Creates and registers the UserIdentityObserver to the SAPURLSession, then sends a validation request which will trigger an authentication flow.
Customization
During the onboarding flow, if there is a splash screen which shows a text, that text can be changed/localized.
// The customized WelcomeStep can be created like the following code snippet
func customSLSAuthStep() -> OnboardingStep {
let slsAuthenticationBundle = Bundle(for: SLSAuthenticationStep.self)
let localizedInfoScreenText = NSLocalizedString("SLSInfoScreenText", tableName: "Example Table name", bundle: slsAuthenticationBundle, value: "Validating credentials", comment: "")
let localizedCancelButtonText = NSLocalizedString("CancelButtonText", tableName: "Example Table name", bundle: slsAuthenticationBundle, value: "Cancel", comment: "")
let localizedInformationLabelText = NSLocalizedString("SLSInformationLabelTextKey", tableName: "Example Table name", bundle: slsAuthenticationBundle, value: "Please enter your credentials", comment: "")
let localizedSignInButtonText = NSLocalizedString("SLSSignInButtonText", tableName: "Example Table name", bundle: slsAuthenticationBundle, value: "Sign In", comment: "")
let presenter = SLSLoginInputPresenter()
presenter.loginViewControllerConfigurationHandler = { viewController in
viewController.informationLabel.text = localizedInformationLabelText
viewController.navigationItem.leftBarButtonItem?.title = localizedCancelButtonText
viewController.navigationItem.rightBarButtonItem?.title = localizedSignInButtonText
}
let step = SLSAuthenticationStep(slsLoginInputPresenter: presenter)
step.infoScreenText = localizedInfoScreenText
return step
}
-
The key used to store the SLSConfigurationParameters in the result If the slsConfigurationParametersInfoKey has value in the context, the onboard and restore use it with higher priority.
Declaration
Swift
public let slsConfigurationParametersInfoKey: OnboardingInfoKey
-
The key used to store the SAPcpmsSettingsParameters in the result If the slsConfigurationParametersInfoKey is missing in the context, the onboard and restore use sapcpmsSettingsParametersInfoKey value in the context.
Declaration
Swift
public let sapcpmsSettingsParametersInfoKey: OnboardingInfoKey
-
Property to set the title of info screen
Declaration
Swift
public var infoScreenText: String
-
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 istrue
.Declaration
Swift
public var isAllowingOfflineRestore: Bool
-
Designated initializer
Declaration
Swift
public init(slsLoginInputPresenter: SLSLoginInputDelegate & FlowPresentationDelegateClient = SLSLoginInputPresenter(), slsConfigurationParametersInfoKey: OnboardingInfoKey = OnboardingInfoKey.slsConfigurationParameters, sapcpmsSettingsParametersInfoKey: OnboardingInfoKey = OnboardingInfoKey.sapcpmsSettingsParameters)
Parameters
slsLoginInputPresenter
Presenter delegate and SLSLoginInput delegate
slsConfigurationParametersInfoKey
OnboardingInfoKey
to reach the configuration parameters
-
onboard(sapURLSession:authenticationURL:credentialStore:presentationDelegate:slsConfigurationParameters:completionHandler:)
Onboards to the given URL
Declaration
Swift
open func onboard(sapURLSession: SAPURLSession, authenticationURL: URL, credentialStore: CodableStoring, presentationDelegate: FlowPresentationDelegate, slsConfigurationParameters: SLSConfigurationParameters, completionHandler: @escaping (Error?) -> Void)
Parameters
sapURLSession
SAPURLSession
that handle the connection to the authenticationURLauthenticationURL
resource URL that needs SLS authentication
credentialStore
UserIdentity
will save in the given storepresentationDelegate
delegate to present the
ViewController
for authenticationslsConfigurationParameters
prefilled
SLSConfigurationParameters
instancecompletionHandler
called when the process finished. Error filled on failure.
-
restore(sapURLSession:authenticationURL:credentialStore:presentationDelegate:slsConfigurationParameters:completionHandler:)
Restore the previous state of onboarding
Declaration
Swift
open func restore(sapURLSession: SAPURLSession, authenticationURL: URL, credentialStore: CodableStoring, presentationDelegate: FlowPresentationDelegate, slsConfigurationParameters: SLSConfigurationParameters, completionHandler: @escaping (Error?) -> Void)
Parameters
sapURLSession
SAPURLSession
that handle the connection to the authenticationURLauthenticationURL
resource URL that needs SLS authentication
credentialStore
UserIdentity
will save in the given storepresentationDelegate
delegate to present the
ViewController
for authenticationslsConfigurationParameters
prefilled
SLSConfigurationParameters
instancecompletionHandler
called when the process finished. Error filled on failure.
-
Resets the step’s onboarding state
Declaration
Swift
open func reset(sapURLSession: SAPURLSession, completionHandler: @escaping () -> Void)
Parameters
completionHandler
called when the process finished
-
Create a store to keep the credential
Declaration
Swift
open func createUserIdentityStore(using credentialsStore: CodableStoring) -> UserIdentityStoring
Parameters
credentialsStore
The provided base store.
Return Value
An instance of
UserIdentity
.
-
Onboarding function with
OnboardingContext
supportDeclaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
OnboardingContext
object which contains every information for the OnboardingStepcompletionHandler
called when the process finished. Error filled on failure.
-
Restore function with
OnboardingContext
supportDeclaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
OnboardingContext
object which contains every information for the OnboardingStepcompletionHandler
called when the process finished. Error filled on failure.
-
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 SLSAuthenticationStep modifications in
OnboardingContext
Declaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)
Parameters
context
OnboardingContext
object which contains every information for the OnboardingStepcompletionHandler
called when the process finished.