Class RefreshAuthTokenWrapper<REQUEST extends BmcRequest<?>,​RESPONSE>

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

    public abstract class RefreshAuthTokenWrapper<REQUEST extends BmcRequest<?>,​RESPONSE>
    extends Object
    implements AsyncHandler<REQUEST,​RESPONSE>, Future<RESPONSE>
    Combined future and 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).

    It also wraps a delegate Future, and when the result of the future is requested, but the call fails with a 401, we perform the additional logic described above.

    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.