Class OtpWebViewProcessor
-
- All Implemented Interfaces:
-
com.sap.cloud.mobile.foundation.authentication.OtpProcessor
,com.sap.cloud.mobile.foundation.authentication.OtpResultListener
public class OtpWebViewProcessor implements OtpProcessor, OtpResultListener
This class uses android.webkit.WebView to implement OtpProcessor. This class is meant to be used with a OtpInterceptor to create an OkHttpClient that can handle OTP challenges:
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); OtpConfiguration otpConfiguration = new OtpConfiguration.Builder() .authorizationEndpointUrl(getBaseServerUrl() + "/mobileservices/OTPForm") .finishEndpointUrl(getBaseServerUrl() + "/mobileservices/OTPForm?finished=true") .build(); clientBuilder.addInterceptor(new OtpInterceptor(otpConfiguration)); OkHttpClient okHttpClient = clientBuilder.build();
-
-
Constructor Summary
Constructors Constructor Description OtpWebViewProcessor(OtpConfiguration otpConfiguration)
Constructs a new OtpWebViewProcessor. OtpWebViewProcessor(OtpConfiguration otpConfiguration, IBackPress iBackPress)
Constructs a new OtpWebViewProcessor, with BackPress listener.
-
Method Summary
Modifier and Type Method Description void
authenticate()
Called when the OtpInterceptor detects an OTP challenge. void
cancelAuthentication()
Cancels the ongoing authentication process. void
onOtpResult(@NonNull() Uri uri)
Called by OtpResponseActivity with the Uri passed from SAP Authenticator. -
-
Constructor Detail
-
OtpWebViewProcessor
OtpWebViewProcessor(OtpConfiguration otpConfiguration)
Constructs a new OtpWebViewProcessor.- Parameters:
otpConfiguration
- The configuration information.
-
OtpWebViewProcessor
OtpWebViewProcessor(OtpConfiguration otpConfiguration, IBackPress iBackPress)
Constructs a new OtpWebViewProcessor, with BackPress listener.
-
-
Method Detail
-
authenticate
@WorkerThread() void authenticate()
Called when the OtpInterceptor detects an OTP 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.
-
onOtpResult
void onOtpResult(@NonNull() Uri uri)
Called by OtpResponseActivity with the Uri passed from SAP Authenticator.
- Parameters:
uri
- The Uri from SAP Authenticator.
-
-
-
-