SAMLAuthenticationStep

open class SAMLAuthenticationStep : OnboardingStep

SAML 2.0 onboarding step.

Used in the onboarding / restoring flow, this step is responsible to configure the app’s URLSession to be able to communicate with SAML 2.0 protected resources. Creates and registers the SAMLObserver 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 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 customSAMLAuthStep() -> OnboardingStep {
   let samlBundle = Bundle(for: SAMLAuthenticationStep.self)

   let localizedInfoScreenText = NSLocalizedString("SAMLInfoScreenText", tableName: "Example Table name", bundle: samlBundle, value: "Validating SAML credentials", comment: "")
   let localizedCancelButtonText = NSLocalizedString("CancelButtonText", tableName: "Example Table name", bundle: samlBundle, value: "Cancel", comment: "")

   let presenter = FioriWKWebViewPresenter()
   presenter.webViewControllerConfigurationHandler = { webView in
       webView.cancelButton?.title = localizedCancelButtonText

       return webView
   }

   let step = SAMLAuthenticationStep(presenter: presenter)
   step.infoScreenText = localizedInfoScreenText

   return step
}
  • The OnboardingInfoKey associated with an instance of SAMLAuthenticationParameters in the OnboardingContext info.

    Declaration

    Swift

    public let infoKey: 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 is true.

    Declaration

    Swift

    public var isAllowingOfflineRestore: Bool
  • The OnboardingInfoKey associated with an instance of sapcpmsSettingsParameters in the OnboardingContext info. Used for creating the SAPcpmsAuthenticationManager is the AuthenticationDelegate is present.

    Declaration

    Swift

    public var settingsParametersInfoKey: OnboardingInfoKey
  • The delegate which is called by SAPcpmsAuthenticationManager. If this property is nil, then the SAPcpmsAuthenticationManager will not be created.

    Declaration

    Swift

    public weak var authenticationDelegate: AuthenticationDelegate?
  • Instantiates the SAML onboarding step. Will use an WKWebView instance to authenticate.

    Declaration

    Swift

    public convenience init(presenter: WKWebViewPresenting & FlowPresentationDelegateClient = FioriWKWebViewPresenter(), infoKey: OnboardingInfoKey = .samlAuthenticationParameters)

    Parameters

    infoKey

    The OnboardingInfoKey which marks a SAMLAuthenticationParameters instance in the OnboardingContext.

    webViewPresenter

    The web view presenter which will supply an WKWebView instance.

  • SAMLAuthenticationStep onboard function with presentationDelegate

    Declaration

    Swift

    open func onboard(authenticationURL: URL, authenticationParameters: SAMLAuthenticationParameters, sapURLSession: SAPURLSession, presentationDelegate: FlowPresentationDelegate, credentialStore: CodableStoring? = nil, settingsParameters: SAPcpmsSettingsParameters? = nil, completionHandler: @escaping (Error?) -> Void)

    Parameters

    authenticationURL

    resource URL that needs SAML authentication

    authenticator

    authenticator conforming to SAMLAuthentication protocol

    sapURLSession

    SAPURLSession that handle the connection to the authenticationURL

    presentationDelegate

    FlowPresentationDelegate which handles the webview presenting the SAML Authentication

    credentialStore

    The store used for the SAPcpmsAuthenticationManager to store the authenticated user’s id.

    settingsParameters

    The settings parameters used for creating the SAPcpmsAuthenticationManager.

    completionHandler

    called when the process finished. Error filled on failure.

  • SAMLAuthenticationStep restore function with presentationDelegate

    Declaration

    Swift

    open func restore(authenticationURL: URL, authenticationParameters: SAMLAuthenticationParameters, sapURLSession: SAPURLSession, presentationDelegate: FlowPresentationDelegate, credentialStore: CodableStoring? = nil, settingsParameters: SAPcpmsSettingsParameters? = nil, completionHandler: @escaping (Error?) -> Void)

    Parameters

    authenticationURL

    resource URL that needs SAML authentication

    authenticator

    authenticator conforming to SAMLAuthentication protocol

    sapURLSession

    SAPURLSession that handle the connection to the authenticationURL

    presentationDelegate

    FlowPresentationDelegate which handles the webview presenting the SAML Authentication

    credentialStore

    The store used for the SAPcpmsAuthenticationManager to store the authenticated user’s id.

    settingsParameters

    The settings parameters used for creating the SAPcpmsAuthenticationManager.

    completionHandler

    called when the process finished. Error filled on failure.

  • This function resets the modifications of the SAMLAuthenticationStep in the SAPURLSession.

    Declaration

    Swift

    open func reset(sapURLSession: SAPURLSession, completionHandler: @escaping () -> Void)

    Parameters

    sapURLSession

    SAPURLSession

    completionHandler

    called when the process finished.

  • This method creates the SAMLAuthentication instance used on the SAPURLSession in the OnboardingContext. The step user may override this method to supply a custom SAMLAuthentication.

    Note: The default implementation creates a simple instance of SAMLAuthenticator.

    Declaration

    Swift

    open func createSAMLAuthenticator(authenticationParameters: SAMLAuthenticationParameters, presentationDelegate: FlowPresentationDelegate) -> SAMLAuthentication

    Parameters

    authenticationParameters

    The authentication parameters.

    presentationDelegate

    The presentation delegate.

    Return Value

    An instance of the SAMLAuthentication.

  • This method creates the SAMLObserver instance used on the SAPURLSession in the OnboardingContext. The step user may override this method to supply a custom SAMLObserver. This can be needed if the endpoint has a custom challenge behaviour.

    Note: The default implementation creates a simple instance of SAMLObserver.

    Declaration

    Swift

    open func createSAMLObserver(authenticator: SAMLAuthentication) -> SAMLObserver

    Parameters

    authenticator

    The SAMLAuthenticator used by the observer.

    Return Value

    An instance of the SAMLObserver.