public class NeptuneApacheHttpSigV4Signer extends NeptuneSigV4SignerBase<org.apache.http.client.methods.HttpUriRequest>
HttpUriRequests.
Note that there are certain limitations for the usage of this class. In particular:
org.apache.http.client.utils.URIBuilder do)
using '+'.NeptuneSigV4SignerBase.NeptuneSigV4Signature| Constructor and Description |
|---|
NeptuneApacheHttpSigV4Signer(String regionName,
com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider)
Create a V4 Signer for Apache Commons HTTP requests.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachSignature(org.apache.http.client.methods.HttpUriRequest request,
NeptuneSigV4SignerBase.NeptuneSigV4Signature signature)
Attach the signature provided in the signature object to the nativeRequest.
|
protected com.amazonaws.SignableRequest<?> |
toSignableRequest(org.apache.http.client.methods.HttpUriRequest request)
Convert the native request into an AWS SDK
SignableRequest object which
can be used to perform signing. |
checkNotNull, convertToSignableRequest, extractParametersFromQueryString, signRequestpublic NeptuneApacheHttpSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider) throws NeptuneSigV4SignerException
regionName - name of the region for which the request is signedawsCredentialsProvider - the provider offering access to the credentials used for signing the requestNeptuneSigV4SignerException - in case initialization failsprotected com.amazonaws.SignableRequest<?> toSignableRequest(org.apache.http.client.methods.HttpUriRequest request)
throws NeptuneSigV4SignerException
NeptuneSigV4SignerBaseSignableRequest object which
can be used to perform signing. This means that the information from the request relevant
for signing (such as request URI, query string, headers, etc.) need to be extracted from
the native request and mapped to a SignableRequest object, which is used internally
for the signing process.
Note that the signable request internally, during the signing process, adds a "Host" header. This may lead to problems if the original request has a host header with a name in different capitalization (e.g. "host"), leading to duplicate host headers and the signing process to fail. Hence, when using the API you need to make sure that there is either no host header in your original request or the host header uses the exact string "Host" as the header name. The easiest solution, if you have control over the native HTTP request, is to just leave out the host header when translating and create one when signing (the host header value will be part of the struct returned from the signing process).
toSignableRequest in class NeptuneSigV4SignerBase<org.apache.http.client.methods.HttpUriRequest>request - the native HTTP requestSignableRequestNeptuneSigV4SignerException - in case something goes wrong during translationprotected void attachSignature(org.apache.http.client.methods.HttpUriRequest request,
NeptuneSigV4SignerBase.NeptuneSigV4Signature signature)
throws NeptuneSigV4SignerException
NeptuneSigV4SignerBaseattachSignature in class NeptuneSigV4SignerBase<org.apache.http.client.methods.HttpUriRequest>request - the native HTTP requestsignature - the signature information to attachNeptuneSigV4SignerException - in case something goes wrong during signing of the native request