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 that the connection to the server needs validation. If this property is true, a validation request will be sent to the authenticationURL during the onboard / restore process. The authenticationURL is contained in the info object of the OnboardingContext. By default this property is true.

    Declaration

    Swift

    @available(*, deprecated, message: "This property is marked as deprecated since the support for gracefully handling network conditions when restoring while offline has been automated into the step.")
    public var sendsValidationRequest: 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

  • 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 authenticationURL

    authenticationURL

    resource URL that needs SLS authentication

    credentialStore

    UserIdentity will save in the given store

    presentationDelegate

    delegate to present the ViewController for authentication

    slsConfigurationParameters

    prefilled SLSConfigurationParameters instance

    completionHandler

    called when the process finished. Error filled on failure.

  • 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 authenticationURL

    authenticationURL

    resource URL that needs SLS authentication

    credentialStore

    UserIdentity will save in the given store

    presentationDelegate

    delegate to present the ViewController for authentication

    slsConfigurationParameters

    prefilled SLSConfigurationParameters instance

    completionHandler

    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.