code: private void populateRequestWithMfaDetails(Request<?> request, MultiFactorAuthentication mfa) {
          if (mfa == null) return;
  
          String endpoint = request.getEndpoint().toString();
          if (endpoint.startsWith("http://")) {
              String httpsEndpoint = endpoint.replace("http://", "https://");
              request.setEndpoint(URI.create(httpsEndpoint));
              log.info("Overriding current endpoint to use HTTPS " +
                      "as required by S3 for requests containing an MFA header");
          }
  
          request.addHeader(Headers.S3_MFA,
                  mfa.getDeviceSerialNumber() + " " + mfa.getToken());
      }
docs: <p>
  Populates the specified request with the specified Multi-Factor
  Authentication (MFA) details. This includes the MFA header with device serial
  number and generated token. Since all requests which include the MFA
  header must be sent over HTTPS, this operation also configures the request object to
  use HTTPS instead of HTTP.
  </p>
  
  @param request
  The request to populate.
  @param mfa
  The Multi-Factor Authentication information.