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
OnboardingInfoKeyassociated with an instance ofSAMLAuthenticationParametersin theOnboardingContextinfo.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
OnboardingInfoKeyassociated with an instance ofsapcpmsSettingsParametersin theOnboardingContextinfo. 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
WKWebViewinstance to authenticate.Declaration
Swift
public convenience init(presenter: WKWebViewPresenting & FlowPresentationDelegateClient = FioriWKWebViewPresenter(), infoKey: OnboardingInfoKey = .samlAuthenticationParameters)Parameters
infoKeyThe
OnboardingInfoKeywhich marks aSAMLAuthenticationParametersinstance in theOnboardingContext.webViewPresenterThe web view presenter which will supply an
WKWebViewinstance. -
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
authenticationURLresource URL that needs SAML authentication
authenticatorauthenticator conforming to SAMLAuthentication protocol
sapURLSessionSAPURLSessionthat handle the connection to the authenticationURLpresentationDelegateFlowPresentationDelegate which handles the webview presenting the SAML Authentication
credentialStoreThe store used for the SAPcpmsAuthenticationManager to store the authenticated user’s id.
settingsParametersThe settings parameters used for creating the SAPcpmsAuthenticationManager.
completionHandlercalled 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
authenticationURLresource URL that needs SAML authentication
authenticatorauthenticator conforming to SAMLAuthentication protocol
sapURLSessionSAPURLSessionthat handle the connection to the authenticationURLpresentationDelegateFlowPresentationDelegate which handles the webview presenting the SAML Authentication
credentialStoreThe store used for the SAPcpmsAuthenticationManager to store the authenticated user’s id.
settingsParametersThe settings parameters used for creating the SAPcpmsAuthenticationManager.
completionHandlercalled 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
sapURLSessionSAPURLSessioncompletionHandlercalled when the process finished.
-
This method creates the
SAMLAuthenticationinstance used on theSAPURLSessionin 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) -> SAMLAuthenticationParameters
authenticationParametersThe authentication parameters.
presentationDelegateThe presentation delegate.
Return Value
An instance of the
SAMLAuthentication. -
This method creates the
SAMLObserverinstance used on theSAPURLSessionin 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) -> SAMLObserverParameters
authenticatorThe
SAMLAuthenticatorused by the observer.Return Value
An instance of the
SAMLObserver.
-
Onboarding function with
OnboardingContextsupportDeclaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled when the process finished. Error filled on failure.
-
Restore function with
OnboardingContextsupportDeclaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled when the process finished. Error filled on failure.
-
background function with
OnboardingContextsupportDeclaration
Swift
open func background(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled when the process finished. Error filled on failure.
-
resetPasscode function with
OnboardingContextsupportDeclaration
Swift
open func resetPasscode(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
contextcompletionHandlercalled when the process finished. Step OnboardingResult filled.
-
This function resets the modifications of SAMLAuthenticationStep modifications in
OnboardingContextDeclaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)Parameters
contextOnboardingContext object, where the reset should be applied
completionHandlercompletion which should be called after reset