Class ChfHttpTransport

java.lang.Object
com.google.api.client.http.HttpTransport
org.forgerock.secrets.gcpkms.ChfHttpTransport

public class ChfHttpTransport extends com.google.api.client.http.HttpTransport
Implementation of the Google Cloud API HttpTransport interface using CHF. This allows CHF to be used as the HTTP client library for REST calls to Google Cloud Platform. Example:

 Handler chfHandler = new HttpClientHandler();
 Supplier<Context> contextSupplier = RootContext::new;
 HttpTransportFactory httpTransportFactory = () -> new ChfHttpTransport(chfHandler, contextSupplier);

 GoogleCredentials credentials = ServiceAccountCredentials.fromStream(
         new FileInputStream("/engineering-devops-afce7aa71027.json"), httpTransportFactory);
 credentials = credentials.createScoped("https://www.googleapis.com/auth/cloudkms");
 

Note: it is not possible to change the transport used for RPC calls to GCP services, so this will only be used to obtain OAuth access tokens and other auxiliary requests.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ChfHttpTransport(Handler httpHandler, Supplier<Context> context)
    Initialises the transport with the given CHF client handler and context supplier.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.google.api.client.http.LowLevelHttpRequest
    buildRequest(String method, String url)
     

    Methods inherited from class com.google.api.client.http.HttpTransport

    createRequestFactory, createRequestFactory, isMtls, isShutdown, shutdown, supportsMethod

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChfHttpTransport

      public ChfHttpTransport(Handler httpHandler, Supplier<Context> context)
      Initialises the transport with the given CHF client handler and context supplier.
      Parameters:
      httpHandler - the CHF client handler.
      context - a supplier for the context argument to use on requests.
  • Method Details

    • buildRequest

      protected com.google.api.client.http.LowLevelHttpRequest buildRequest(String method, String url)
      Specified by:
      buildRequest in class com.google.api.client.http.HttpTransport