Package org.forgerock.secrets.gcpkms
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
ConstructorDescriptionChfHttpTransport
(Handler httpHandler, Supplier<Context> context) Initialises the transport with the given CHF client handler and context supplier. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
-
Constructor Details
-
ChfHttpTransport
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
- Specified by:
buildRequest
in classcom.google.api.client.http.HttpTransport
-