Package com.amazonaws.neptune.auth
Class NeptuneRequestMetadataSigV4Signer
- java.lang.Object
-
- com.amazonaws.neptune.auth.NeptuneSigV4SignerBase<RequestMetadata>
-
- com.amazonaws.neptune.auth.NeptuneRequestMetadataSigV4Signer
-
- All Implemented Interfaces:
NeptuneSigV4Signer<RequestMetadata>
public class NeptuneRequestMetadataSigV4Signer extends NeptuneSigV4SignerBase<RequestMetadata>
Signer for HTTP requests encapsulalted inRequestMetadatas.Note that there are certain limitations for the usage of this class. In particular:
- The implementation 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.
- When using GET, the underlying HTTP request needs to encode whitespaces in query parameters using '%20'
rather than (what most APIs such as the Apache commons
URIBuilderdo) using '+'.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.amazonaws.neptune.auth.NeptuneSigV4SignerBase
NeptuneSigV4SignerBase.NeptuneSigV4Signature
-
-
Constructor Summary
Constructors Constructor Description NeptuneRequestMetadataSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider)Create a V4 Signer forRequestMetadata.NeptuneRequestMetadataSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider, String serviceName)Create a V4 Signer forRequestMetadata.NeptuneRequestMetadataSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider)Create a V4 Signer forRequestMetadata.NeptuneRequestMetadataSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider, String serviceName)Create a V4 Signer forRequestMetadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidattachSignature(RequestMetadata request, NeptuneSigV4SignerBase.NeptuneSigV4Signature signature)Takes aRequestMetadataand updates the headers required for SigV4 auth.protected software.amazon.awssdk.http.SdkHttpFullRequesttoSignableRequest(RequestMetadata request)Converts aRequestMetadatato a signable metadata by adding signature headers for AWS SigV4 auth.-
Methods inherited from class com.amazonaws.neptune.auth.NeptuneSigV4SignerBase
checkNotNull, convertToSignableRequest, extractParametersFromQueryString, signRequest
-
-
-
-
Constructor Detail
-
NeptuneRequestMetadataSigV4Signer
public NeptuneRequestMetadataSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider) throws NeptuneSigV4SignerException
Create a V4 Signer forRequestMetadata.- Parameters:
regionName- name of the region for which the request is signedv1AwsCredentialProvider- the provider offering access to the credentials used for signing the request- Throws:
NeptuneSigV4SignerException- in case initialization fails
-
NeptuneRequestMetadataSigV4Signer
public NeptuneRequestMetadataSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider, String serviceName) throws NeptuneSigV4SignerException
Create a V4 Signer forRequestMetadata.- Parameters:
regionName- name of the region for which the request is signedv1AwsCredentialProvider- the provider offering access to the credentials used for signing the requestserviceName- name of the service name used to sign the requests. Defaults to neptune-db- Throws:
NeptuneSigV4SignerException- in case initialization fails
-
NeptuneRequestMetadataSigV4Signer
public NeptuneRequestMetadataSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider) throws NeptuneSigV4SignerException
Create a V4 Signer forRequestMetadata.- Parameters:
regionName- name of the region for which the request is signedawsCredentialsProvider- the provider offering access to the credentials used for signing the request- Throws:
NeptuneSigV4SignerException- in case initialization fails
-
NeptuneRequestMetadataSigV4Signer
public NeptuneRequestMetadataSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider, String serviceName) throws NeptuneSigV4SignerException
Create a V4 Signer forRequestMetadata.- Parameters:
regionName- name of the region for which the request is signedawsCredentialsProvider- the provider offering access to the credentials used for signing the requestserviceName- name of the service name used to sign the requests. Defaults to neptune-db- Throws:
NeptuneSigV4SignerException- in case initialization fails
-
-
Method Detail
-
toSignableRequest
protected software.amazon.awssdk.http.SdkHttpFullRequest toSignableRequest(RequestMetadata request) throws NeptuneSigV4SignerException
Converts aRequestMetadatato a signable metadata by adding signature headers for AWS SigV4 auth.- Specified by:
toSignableRequestin classNeptuneSigV4SignerBase<RequestMetadata>- Parameters:
request- the request metadata object.- Returns:
- the signed
RequestMetadata. - Throws:
NeptuneSigV4SignerException- if there are issues while attempting to generate the signature.
-
attachSignature
protected void attachSignature(RequestMetadata request, NeptuneSigV4SignerBase.NeptuneSigV4Signature signature) throws NeptuneSigV4SignerException
Takes aRequestMetadataand updates the headers required for SigV4 auth. These include the host header, date header and the authorization header obtained from theNeptuneSigV4SignerBase.NeptuneSigV4Signature. Removes the host header if already present in the request.- Specified by:
attachSignaturein classNeptuneSigV4SignerBase<RequestMetadata>- Parameters:
request- the request metadata.signature- the signature information to attach- Throws:
NeptuneSigV4SignerException- if there is an error in performing the update.
-
-