Class SamlWebViewProcessor

  • All Implemented Interfaces:
    com.sap.cloud.mobile.foundation.authentication.SamlProcessor

    
    public class SamlWebViewProcessor
     implements SamlProcessor
                        

    This class uses android.webkit.WebView to implement SamlProcessor. This class is meant to be used with a SamlInterceptor to create an OkHttpClient that can handle SAML challenges:

    
    OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
    clientBuilder.cookieJar(new WebkitCookieJar());
    clientBuilder.addInterceptor(new AppHeadersInterceptor(appId));
    SamlConfiguration samlConfiguration = new SamlConfiguration.Builder()
            .authUrl(getBaseServerUrl() + "/SAMLAuthLauncher")
            .build();
    samlProcessor = new SamlWebViewProcessor(samlConfiguration);
    clientBuilder.addInterceptor(new SamlInterceptor(samlProcessor));
    OkHttpClient okHttpClient = clientBuild.build();
    
    • Constructor Detail

      • SamlWebViewProcessor

        SamlWebViewProcessor(SamlConfiguration samlConfiguration)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        samlConfiguration - The configuration info.
      • SamlWebViewProcessor

        SamlWebViewProcessor(SamlConfiguration samlConfiguration, IBackPress iBackPress)
        Constructs a new SamlWebViewProcessor, with BackPress listener
      • SamlWebViewProcessor

        SamlWebViewProcessor(SamlConfiguration samlConfiguration, CertificateProvider certificateProvider)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        samlConfiguration - The configuration info.
        certificateProvider - Used to get a client certificate is the server requests one.
      • SamlWebViewProcessor

        SamlWebViewProcessor(SamlConfiguration samlConfiguration, CertificateProvider certificateProvider, IBackPress iBackPress)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        samlConfiguration - The configuration info.
        certificateProvider - Used to get a client certificate is the server requests one.
        iBackPress - The back key event listener
      • SamlWebViewProcessor

        SamlWebViewProcessor(SettingsParameters settingsParameters)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        settingsParameters - Used to create a SamlConfiguration.
      • SamlWebViewProcessor

        SamlWebViewProcessor()
        Constructs a new SamlWebViewProcessor.
      • SamlWebViewProcessor

        SamlWebViewProcessor(SettingsParameters settingsParameters, CertificateProvider certificateProvider)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        settingsParameters - Used to create a SamlConfiguration.
        certificateProvider - Used to get a client certificate is the server requests one.
      • SamlWebViewProcessor

        SamlWebViewProcessor(CertificateProvider certificateProvider)
        Constructs a new SamlWebViewProcessor.
        Parameters:
        certificateProvider - Used to get a client certificate is the server requests one.
    • Method Detail

      • authenticate

        @WorkerThread() void authenticate()

        Called when the SamlInterceptor detects a SAML challenge. Either authentication will be successful or an IOException will be thrown.

      • cancelAuthentication

         void cancelAuthentication()

        Cancels the ongoing authentication process. Does nothing if there was no ongoing authentication.