public final class AWSV4Signer extends Object
You can add the authentication information to the request with an Authorization header. Although the HTTP header is named Authorization, the signing information is actually used for authentication to establish who the request came from
The Authorization header includes the following information:
Algorithm you used for signing (AWS4-HMAC-SHA256)
Credential scope (with your access key ID)
List of signed headers
Calculated signature. The signature is based on your request information, and you use your AWS secret access key to produce the signature. The signature confirms your identity to AWS. https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
Modifier and Type | Method and Description |
---|---|
static void |
sign(AWSSignableRequest request)
Creates the sign string needed to authenticate an Amazon AWS request on Version 4 and passes it back by an
invokation to
AWSSignableRequest.sign(String) . |
public static void sign(AWSSignableRequest request) throws AWSSignatureException
AWSSignableRequest.sign(String)
.
In order to create the signature, this method must read AWSSignableRequest.getPayload()
.
After the stream is read, it will be InputStream.reset()
. This behavior is different from 1.0.x versions
of this library which did NOT reset the stream.
TODO this method should probably not be static.. instead it should implement an instance method from a "signer"
interface so that we can swap signature versions. there's also an opportunity to clean this method up a bit.
started with SignatureRequest
but moving everything there will reduce this method to practically
nothing...request
- an AWSSignableRequest
with the request values to generate the signature and sign it with
the generated keyAWSSignatureException