SAPcpmsUserIdentityDiscoveryAuthenticationStep
open class SAPcpmsUserIdentityDiscoveryAuthenticationStep : OnboardingStep
Onboarding step implementation of SAPcpmsUserIdentityDiscovery Authentication Used in the onboarding/restoring flow, this step is responsible to configure the app’s URLSession to be able to communicate with SAPcpmsUserIdentityDiscovery 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 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.
//The localized SAPcpmsUserIdentityDiscoveryAuthenticationStep can be created like the following code snippet
func customSAPcpmsUserIdentityDiscoveryAuthenticationStep() -> OnboardingStep {
let step = SAPcpmsUserIdentityDiscoveryAuthenticationStep()
let userIdentityDiscoveryAuthenticationBundle = Bundle(for: SAPcpmsUserIdentityDiscoveryAuthenticationStep.self)
step.infoScreenText = NSLocalizedString("UserIdentityDiscoveryInfoScreenTextKey", tableName: "ExampleTableName", bundle: userIdentityDiscoveryAuthenticationBundle, value: "Example Info Screen Text", comment: "")
return step
}
-
The
OnboardingInfoKey
associated with an instance ofSAPcpmsUserIdentityDiscoveryConfigurationParameters
in theOnboardingContext
info.Declaration
Swift
public let userIdentityConfigurationParametersInfoKey: OnboardingInfoKey
-
The
OnboardingInfoKey
associated with an instance ofSAPcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters
in theOnboardingContext
info.Declaration
Swift
public let oauth2AuthenticationParametersInfoKey: OnboardingInfoKey
-
The presentationDelegate to present the WebViewController
Declaration
Swift
public var presenter: FlowPresentationDelegateClient!
-
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
-
init(presenter:userIdentityConfigurationParametersInfoKey:oauth2ClientCredentialsAuthenticationParametersInfoKey:)
Instantiates the SAPcpmsUserIdentityDiscovery onboarding step.
Declaration
Swift
public init(presenter webViewPresenter: WKWebViewPresenting & FlowPresentationDelegateClient = FioriWKWebViewPresenter(), userIdentityConfigurationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryConfigurationParameters, oauth2ClientCredentialsAuthenticationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters)
Parameters
webViewPresenter
The web view presenter which will supply an
WKWebView
instance.userIdentityConfigurationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryConfigurationParameters
instance in theOnboardingContext
.oauth2ClientCredentialsAuthenticationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters
instance in theOnboardingContext
. -
init(presenter:userIdentityConfigurationParametersInfoKey:oauth2ClientCredentialsAuthenticationParametersInfoKey:)
Instantiates the SAPcpmsUserIdentityDiscovery onboarding step.
Declaration
Swift
public init(presenter webViewPresenter: SFSafariViewControllerPresenting & FlowPresentationDelegateClient, userIdentityConfigurationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryConfigurationParameters, oauth2ClientCredentialsAuthenticationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters)
Parameters
webViewPresenter
The web view presenter which will supply an
SFSafariViewController
instance.userIdentityConfigurationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryConfigurationParameters
instance in theOnboardingContext
.oauth2ClientCredentialsAuthenticationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters
instance in theOnboardingContext
. -
init(presenter:userIdentityConfigurationParametersInfoKey:oauth2ClientCredentialsAuthenticationParametersInfoKey:)
Instantiates the SAPcpmsUserIdentityDiscovery onboarding step.
Declaration
Swift
@available(iOS 12.0, *) public init(presenter webViewPresenter: ASWebAuthenticationSessionPresenting & FlowPresentationDelegateClient, userIdentityConfigurationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryConfigurationParameters, oauth2ClientCredentialsAuthenticationParametersInfoKey: OnboardingInfoKey = .sapcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters)
Parameters
webViewPresenter
The web view presenter which will supply an
ASWebAuthenticationSession
instance.userIdentityConfigurationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryConfigurationParameters
instance in theOnboardingContext
.oauth2ClientCredentialsAuthenticationParametersInfoKey
The
OnboardingInfoKey
which marks aSAPcpmsUserIdentityDiscoveryOAuth2AuthenticationParameters
instance in theOnboardingContext
.
-
onboard(sapURLSession:authenticationURL:credentialStore:presentationDelegate:userIdentityConfigurationParameters:oauth2AuthenticationParameters:completionHandler:)
Onboards to the given URL
Declaration
Swift
open func onboard(sapURLSession: SAPURLSession, authenticationURL: URL, credentialStore: CodableStoring, presentationDelegate: FlowPresentationDelegate, userIdentityConfigurationParameters: SAPcpmsUserIdentityConfigurationParameters, oauth2AuthenticationParameters: OAuth2AuthenticationParameters, completionHandler: @escaping (Error?) -> Void)
Parameters
sapURLSession
SAPURLSession
that handle the connection to the authenticationURLauthenticationURL
resource URL that needs basic authentication
credentialStore
UserIdentity
will save in the given storepresentationDelegate
delegate to present the
BasicCredentialViewController
userIdentityConfigurationParameters
configuration parameters for the discovery service
oAuth2AuthenticationParameters
authentication parameters for the OAuth2 authentication
completionHandler
called when the process finished. Error filled on failure.
-
restore(sapURLSession:authenticationURL:credentialStore:presentationDelegate:userIdentityConfigurationParameters:oauth2AuthenticationParameters:completionHandler:)
Restore the previous state of onboarding
Declaration
Swift
open func restore(sapURLSession: SAPURLSession, authenticationURL: URL, credentialStore: CodableStoring, presentationDelegate: FlowPresentationDelegate, userIdentityConfigurationParameters: SAPcpmsUserIdentityConfigurationParameters, oauth2AuthenticationParameters: OAuth2AuthenticationParameters, completionHandler: @escaping (Error?) -> Void)
Parameters
sapURLSession
SAPURLSession
that handle the connection to the authenticationURLauthenticationURL
resource URL that needs basic authentication
credentialStore
UserIdentity
will save in the given storepresentationDelegate
delegate to present the
BasicCredentialViewController
userIdentityConfigurationParameters
configuration parameters for the discovery service
oAuth2AuthenticationParameters
authentication parameters for the OAuth2 authentication
completionHandler
called when the process finished. Error filled on failure.
-
Resets the modifications of OnboardingStep
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 store to use when handling
UserIdentity
s.Return Value
a
UserIdentityStoring
to store and retrieve theUserIdentity
s.
-
Onboarding function with
OnboardingContext
supportDeclaration
Swift
open func onboard(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Filled with OnboardingResult
-
Restore function with
OnboardingContext
supportDeclaration
Swift
open func restore(context: OnboardingContext, completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
context
completionHandler
called when the process finished. Filled with OnboardingResult
-
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.
-
Reset function with
OnboardingContext
supportDeclaration
Swift
open func reset(context: OnboardingContext, completionHandler: @escaping () -> Void)
Parameters
context
OnboardingContext
object which contains every information for the OnboardingStepcompletionHandler
called when the process finished.