Class AWS4PreSignedUrlSigner
AWS4 protocol signer for Amazon S3 presigned urls.
public class AWS4PreSignedUrlSigner : AWS4Signer
- Inheritance
-
AWS4PreSignedUrlSigner
- Inherited Members
Constructors
AWS4PreSignedUrlSigner()
public AWS4PreSignedUrlSigner()
Fields
MaxAWS4PreSignedUrlExpiry
public const long MaxAWS4PreSignedUrlExpiry = 604800
Field Value
ServicesUsingUnsignedPayload
public static readonly IEnumerable<string> ServicesUsingUnsignedPayload
Field Value
Methods
Sign(IRequest, IClientConfig, RequestMetrics, ImmutableCredentials)
Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters. The resulting signature is added to the request headers as 'Authorization'.
public override void Sign(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, ImmutableCredentials credentials)
Parameters
request
IRequestThe request to compute the signature for. Additional headers mandated by the AWS4 protocol ('host' and 'x-amz-date') will be added to the request before signing.
clientConfig
IClientConfigAdding supporting data for the service call required by the signer (notably authentication region, endpoint and service name).
metrics
RequestMetricsMetrics for the request
credentials
ImmutableCredentialsThe AWS credentials for the account making the service call.
Exceptions
- SignatureException
If any problems are encountered while signing the request.
Sign(IRequest, IClientConfig, RequestMetrics, string, string)
Calculates and signs the specified request using the AWS4 signing protocol by using the AWS account credentials given in the method parameters. The resulting signature is added to the request headers as 'Authorization'.
public override void Sign(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey)
Parameters
request
IRequestThe request to compute the signature for. Additional headers mandated by the AWS4 protocol ('host' and 'x-amz-date') will be added to the request before signing.
clientConfig
IClientConfigAdding supporting data for the service call required by the signer (notably authentication region, endpoint and service name).
metrics
RequestMetricsMetrics for the request
awsAccessKeyId
stringThe AWS public key for the account making the service call.
awsSecretAccessKey
stringThe AWS secret key for the account making the call, in clear text
Exceptions
- SignatureException
If any problems are encountered while signing the request.
SignRequest(IRequest, IClientConfig, RequestMetrics, string, string)
Calculates the AWS4 signature for a presigned url.
public AWS4SigningResult SignRequest(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey)
Parameters
request
IRequestThe request to compute the signature for. Additional headers mandated by the AWS4 protocol ('host' and 'x-amz-date') will be added to the request before signing. If the Expires parameter is present, it is renamed to 'X-Amz-Expires' before signing.
clientConfig
IClientConfigAdding supporting data for the service call required by the signer (notably authentication region, endpoint and service name).
metrics
RequestMetricsMetrics for the request
awsAccessKeyId
stringThe AWS public key for the account making the service call.
awsSecretAccessKey
stringThe AWS secret key for the account making the call, in clear text
Returns
Remarks
Parameters passed as part of the resource path should be uri-encoded prior to entry to the signer. Parameters passed in the request.Parameters collection should be not be encoded; encoding will be done for these parameters as part of the construction of the canonical request.
Exceptions
- SignatureException
If any problems are encountered while signing the request.
SignRequest(IRequest, IClientConfig, RequestMetrics, string, string, string, string)
Calculates the AWS4 signature for a presigned url.
public static AWS4SigningResult SignRequest(IRequest request, IClientConfig clientConfig, RequestMetrics metrics, string awsAccessKeyId, string awsSecretAccessKey, string service, string overrideSigningRegion)
Parameters
request
IRequestThe request to compute the signature for. Additional headers mandated by the AWS4 protocol ('host' and 'x-amz-date') will be added to the request before signing. If the Expires parameter is present, it is renamed to 'X-Amz-Expires' before signing.
clientConfig
IClientConfigAdding supporting data for the service call required by the signer (notably authentication region, endpoint and service name).
metrics
RequestMetricsMetrics for the request
awsAccessKeyId
stringThe AWS public key for the account making the service call.
awsSecretAccessKey
stringThe AWS secret key for the account making the call, in clear text
service
stringThe service to sign for
overrideSigningRegion
stringThe region to sign to, if null then the region the client is configured for will be used.
Returns
Remarks
Parameters passed as part of the resource path should be uri-encoded prior to entry to the signer. Parameters passed in the request.Parameters collection should be not be encoded; encoding will be done for these parameters as part of the construction of the canonical request.
The X-Amz-Content-SHA256 is cleared out of the request. If the request is for S3 then the UNSIGNED_PAYLOAD value is used to generate the canonical request. If the request isn't for S3 then the empty body SHA is used to generate the canonical request.
Exceptions
- SignatureException
If any problems are encountered while signing the request.