LogoutHandler

public class LogoutHandler
extension LogoutHandler: SAPURLSessionObserving
extension LogoutHandler : AppDelegateObserving, SceneDelegateObserving

Class responsible for managing the logout process in the browser.

Example Usage:

Do not forget to set few things before calling logout:

In case of OAUth or SAML Authorization (with Presenter)
```swift
LogoutHandler.shared.set(sapURLSession: <SAPURLSession>)
LogoutHandler.shared.set(settingsParameters: <SAPcpmsSettingsParameters>)
LogoutHandler.shared.set(authenticationType: <AuthenticationType>)
```

In case of Basic Authorization
```swift
LogoutHandler.shared.set(sapURLSession: <SAPURLSession>)
```

In case of OAuth (with External Browser)
```swift
LogoutHandler.shared.set(sapURLSession: <SAPURLSession>)
LogoutHandler.shared.set(settingsParameters: <SAPcpmsSettingsParameters>)
LogoutHandler.shared.set(authenticationTypeForBrowser: <AuthenticationTypeForBrowser>)
```

Do logout:

LogoutHandler.shared.logout { error in
   if error == nil {
    // handle success case
   } else {
    // handle error case
   }
 }
  • Handles HTTP redirections during the logout process. It saves the first redirect request, and calls the handler which will further load that request in the browser.

    Declaration

    Swift

    public func sapURLSession(_ session: SAPURLSession, task: SAPURLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (SAPURLSession.HTTPRedirectDisposition) -> Void)

    Parameters

    session

    The SAPURLSession instance managing the tasks.

    task

    The SAPURLSessionTask that is being redirected.

    response

    The HTTP response containing redirection information.

    request

    The new URLRequest that is being redirected to.

    completionHandler

    A closure to call with the disposition of the redirect.

  • Declaration

    Swift

    public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool
  • Declaration

    Swift

    public func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)