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
}
  • 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.