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 ofSAMLAuthenticationParameters
in theOnboardingContext
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 istrue
.Declaration
Swift
public var isAllowingOfflineRestore: Bool
-
The
OnboardingInfoKey
associated with an instance ofsapcpmsSettingsParameters
in theOnboardingContext
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 aSAMLAuthenticationParameters
instance in theOnboardingContext
.webViewPresenter
The web view presenter which will supply an
WKWebView
instance. -
onboard(authenticationURL:authenticationParameters:sapURLSession:presentationDelegate:credentialStore:settingsParameters:completionHandler:)
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 authenticationURLpresentationDelegate
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.
-
restore(authenticationURL:authenticationParameters:sapURLSession:presentationDelegate:credentialStore:settingsParameters:completionHandler:)
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 authenticationURLpresentationDelegate
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 theSAPURLSession
in theOnboardingContext
. The step user may override this method to supply a customSAMLAuthentication
.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 theSAPURLSession
in theOnboardingContext
. The step user may override this method to supply a customSAMLObserver
. 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
.
-
Onboarding function with
OnboardingContext
supportDeclaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
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
completionHandler
called when the process finished. Error filled on failure.
-
background function with
OnboardingContext
supportDeclaration
Swift
open func background(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
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 SAMLAuthenticationStep modifications in
OnboardingContext
Declaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)
Parameters
context
OnboardingContext object, where the reset should be applied
completionHandler
completion which should be called after reset