Class OtpInterceptor
-
- All Implemented Interfaces:
-
okhttp3.Interceptor
public class OtpInterceptor implements Interceptor
This class implements a okhttp3.Interceptor which enables OTP authentication.
-
-
Field Summary
Fields Modifier and Type Field Description public volatile Call
authenticatingCall
public final static Interceptor.Companion
Companion
-
Constructor Summary
Constructors Constructor Description OtpInterceptor(OtpProcessor otpProcessor, OtpConfiguration otpConfiguration)
Constructs a new OtpInterceptor. OtpInterceptor(OtpConfiguration otpConfiguration)
Constructs a new OtpInterceptor.
-
Method Summary
Modifier and Type Method Description Call
getAuthenticatingCall()
Gets the Call that is currently being authenticated. Response
intercept(@NonNull() Interceptor.Chain chain)
Collection<Call>
getQueuedCalls()
Gets an unmodifiable collection containing all the Calls that are queued up for authentication. -
-
Constructor Detail
-
OtpInterceptor
OtpInterceptor(OtpProcessor otpProcessor, OtpConfiguration otpConfiguration)
Constructs a new OtpInterceptor.- Parameters:
otpProcessor
- Handles authentication.otpConfiguration
- The configuration information.
-
OtpInterceptor
OtpInterceptor(OtpConfiguration otpConfiguration)
Constructs a new OtpInterceptor.- Parameters:
otpConfiguration
- The configuration information.
-
-
Method Detail
-
getAuthenticatingCall
@Nullable() Call getAuthenticatingCall()
Gets the Call that is currently being authenticated.
- Returns:
The Call that is currently being authenticated.
-
intercept
@NonNull() Response intercept(@NonNull() Interceptor.Chain chain)
-
getQueuedCalls
@NonNull() Collection<Call> getQueuedCalls()
Gets an unmodifiable collection containing all the Calls that are queued up for authentication. Note that the authentication flow will only be re-run for Calls in the collection if authentication fails for the Call currently being authenticated. Calls in the collection may be cancelled. Authentication will not be done for a queued Call that has been cancelled.
- Returns:
An unmodifiable collection containing the Calls awaiting authentication.
-
-
-
-