Class RefreshAuthTokenWrappingAsyncHandler<REQUEST,​RESPONSE>

  • Type Parameters:
    REQUEST - The request type.
    RESPONSE - The response type.
    All Implemented Interfaces:
    AsyncHandler<REQUEST,​RESPONSE>

    public abstract class RefreshAuthTokenWrappingAsyncHandler<REQUEST,​RESPONSE>
    extends Object
    implements AsyncHandler<REQUEST,​RESPONSE>
    Deprecated.
    in favor of RefreshAuthTokenWrapper – versions after 1.25.1 do not use RefreshAuthTokenWrappingAsyncHandler anymore
    Callbacks for asynchronous requests intended to work with some authenticated calls, like instance principals.

    This handler wraps a base AsyncHandler and has additional logic so that if a call fails with a 401, we’ll refresh the auth token and then try again up to a given number of retries (it is recommended that we only do one retry).

    This is to account for scenarios where we have a valid/non-expired token but the permissions for the instance have changed since the token was issued and so on the server-side the presented token is considered invalid.

    • Method Detail

      • onSuccess

        public void onSuccess​(REQUEST request,
                              RESPONSE response)
        Deprecated.
        Description copied from interface: AsyncHandler
        Called if the request was successfully completed.
        Specified by:
        onSuccess in interface AsyncHandler<REQUEST,​RESPONSE>
        Parameters:
        request - The request that was made.
        response - The response that was received.
      • onError

        public void onError​(REQUEST request,
                            Throwable error)
        Deprecated.
        Description copied from interface: AsyncHandler
        Called if the request could not be completed successfully.
        Specified by:
        onError in interface AsyncHandler<REQUEST,​RESPONSE>
        Parameters:
        request - The request that was made.
        error - The error that was received.
      • retryCall

        public abstract void retryCall()
        Deprecated.
        If we need to retry the request (i.e.

        on a 401), this method contains the information on how to do that. This method will be leveraged by the onError callback of this handler.