Package com.amazonaws.neptune.auth
Class NeptuneNettyHttpSigV4Signer
- java.lang.Object
-
- com.amazonaws.neptune.auth.NeptuneSigV4SignerBase<io.netty.handler.codec.http.FullHttpRequest>
-
- com.amazonaws.neptune.auth.NeptuneNettyHttpSigV4Signer
-
- All Implemented Interfaces:
NeptuneSigV4Signer<io.netty.handler.codec.http.FullHttpRequest>
public class NeptuneNettyHttpSigV4Signer extends NeptuneSigV4SignerBase<io.netty.handler.codec.http.FullHttpRequest>
Signer for HTTP requests made via Netty clientsFullHttpRequests.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.amazonaws.neptune.auth.NeptuneSigV4SignerBase
NeptuneSigV4SignerBase.NeptuneSigV4Signature
-
-
Constructor Summary
Constructors Constructor Description NeptuneNettyHttpSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider)Create a V4 Signer for Netty HTTP requests.NeptuneNettyHttpSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider, String serviceName)Create a V4 Signer for Netty HTTP requests.NeptuneNettyHttpSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider)Create a V4 Signer for Netty HTTP requests.NeptuneNettyHttpSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider, String serviceName)Create a V4 Signer for Netty HTTP requests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidattachSignature(io.netty.handler.codec.http.FullHttpRequest request, NeptuneSigV4SignerBase.NeptuneSigV4Signature signature)Attach the signature provided in the signature object to the nativeRequest.protected software.amazon.awssdk.http.SdkHttpFullRequesttoSignableRequest(io.netty.handler.codec.http.FullHttpRequest request)Convert the native request into an AWS SDKSignableRequestobject which can be used to perform signing.-
Methods inherited from class com.amazonaws.neptune.auth.NeptuneSigV4SignerBase
checkNotNull, convertToSignableRequest, extractParametersFromQueryString, signRequest
-
-
-
-
Constructor Detail
-
NeptuneNettyHttpSigV4Signer
public NeptuneNettyHttpSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider) throws NeptuneSigV4SignerException
Create a V4 Signer for Netty HTTP requests.- 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
-
NeptuneNettyHttpSigV4Signer
public NeptuneNettyHttpSigV4Signer(String regionName, com.amazonaws.auth.AWSCredentialsProvider v1AwsCredentialProvider, String serviceName) throws NeptuneSigV4SignerException
Create a V4 Signer for Netty HTTP requests.- 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
-
NeptuneNettyHttpSigV4Signer
public NeptuneNettyHttpSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider) throws NeptuneSigV4SignerException
Create a V4 Signer for Netty HTTP requests.- 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
-
NeptuneNettyHttpSigV4Signer
public NeptuneNettyHttpSigV4Signer(String regionName, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider awsCredentialsProvider, String serviceName) throws NeptuneSigV4SignerException
Create a V4 Signer for Netty HTTP requests.- 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(io.netty.handler.codec.http.FullHttpRequest request) throws NeptuneSigV4SignerExceptionDescription copied from class:NeptuneSigV4SignerBaseConvert the native request into an AWS SDKSignableRequestobject 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 aSignableRequestobject, 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).
- Specified by:
toSignableRequestin classNeptuneSigV4SignerBase<io.netty.handler.codec.http.FullHttpRequest>- Parameters:
request- the native HTTP request- Returns:
- the
SdkHttpFullRequest - Throws:
NeptuneSigV4SignerException- in case something goes wrong during translation
-
attachSignature
protected void attachSignature(io.netty.handler.codec.http.FullHttpRequest request, NeptuneSigV4SignerBase.NeptuneSigV4Signature signature) throws NeptuneSigV4SignerExceptionDescription copied from class:NeptuneSigV4SignerBaseAttach the signature provided in the signature object to the nativeRequest. More precisely, the signature contains two headers, X-AMZ-DATE and an Authorization header, which need to be attached to the native HTTP request as HTTP headers or query string depending on the type of signature requested - header/pre-signed url.- Specified by:
attachSignaturein classNeptuneSigV4SignerBase<io.netty.handler.codec.http.FullHttpRequest>- Parameters:
request- the native HTTP requestsignature- the signature information to attach- Throws:
NeptuneSigV4SignerException- in case something goes wrong during signing of the native request
-
-