Class OtpInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    
    public class OtpInterceptor
     implements Interceptor
                        

    This class implements a okhttp3.Interceptor which enables OTP authentication.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public volatile Call authenticatingCall
      public final static Interceptor.Companion Companion
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.

      • 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.