Codebelt.Extensions.AwsSignature4
9.0.0
dotnet add package Codebelt.Extensions.AwsSignature4 --version 9.0.0
NuGet\Install-Package Codebelt.Extensions.AwsSignature4 -Version 9.0.0
<PackageReference Include="Codebelt.Extensions.AwsSignature4" Version="9.0.0" />
paket add Codebelt.Extensions.AwsSignature4 --version 9.0.0
#r "nuget: Codebelt.Extensions.AwsSignature4, 9.0.0"
// Install Codebelt.Extensions.AwsSignature4 as a Cake Addin #addin nuget:?package=Codebelt.Extensions.AwsSignature4&version=9.0.0 // Install Codebelt.Extensions.AwsSignature4 as a Cake Tool #tool nuget:?package=Codebelt.Extensions.AwsSignature4&version=9.0.0
About
An open-source project (MIT license) that targets and complements AWS Signature Version 4 for API requests. It aims to provide a good developer experience by making it simple to generate AWS4-HMAC-SHA256 HTTP Authorization header.
It is, by heart, free, flexible and built to extend and boost your agile codebelt.
Codebelt.Extensions.AwsSignature4 for .NET
The Codebelt.Extensions.AwsSignature4
namespace complements the Cuemon.AspNetCore.Authentication
namespace while providing a way making and signing HTTP requests in the context of specific AWS services using Signature Version 4.
More documentation available at our documentation site:
CSharp Example
In this example we create an HTTP request with an AWS Signature Version 4 header. The example used here is part of the unit test for Aws4HmacAuthorizationHeaderBuilder
. Unit test is based on xUnit API and is written using convenient extensions for xUnit API by Codebelt.
using var host = WebHostTestFactory.Create();
var context = host.ServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext;
var timestamp = DateTime.Parse("2022-07-10T12:50:42.2737531Z"); // <-- change this to valid date/time
context.Request.Headers.Add(HttpHeaderNames.Host, "cuemon.s3.amazonaws.com");
context.Request.Headers.Add("x-amz-date", timestamp.ToAwsDateTimeString());
context.Request.Headers.Add("x-amz-content-sha256", UnkeyedHashFactory.CreateCryptoSha256().ComputeHash("").ToHexadecimalString());
context.Request.QueryString = QueryString.Create("list-type", "2");
var headerBuilder = new Aws4HmacAuthorizationHeaderBuilder()
.AddFromRequest(context.Request)
.AddClientId("AKIAIOSFODNN7EXAMPLE") // <-- change this to valid access key
.AddClientSecret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") // <-- change this to valid secret
.AddCredentialScope(timestamp);
var header = headerBuilder.Build().ToString(); // <-- AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20220710/eu-west-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=3d2c4a14b38d0283bb697176ade57b2118110de0f00c387d7f0ef58c55a5b91d
Full soucecode: Aws4HmacAuthorizationHeaderBuilderTest
cURL Example
curl --location --request GET 'https://cuemon.s3.amazonaws.com/?list-type=2' --header 'Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20220710/eu-west-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=feeb4c8ba41733fadc73cba6631ddfc9a729f371206bbaa77f216a69dd5299c5' --header 'x-amz-date: 20220710T145042Z' --header 'x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
-
net8.0
- Cuemon.AspNetCore.Authentication (>= 9.0.0)
-
net9.0
- Cuemon.AspNetCore.Authentication (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 88 | 11/13/2024 |
9.0.0-rc.1 | 49 | 11/12/2024 |
9.0.0-preview.2 | 50 | 10/9/2024 |
9.0.0-preview.1 | 49 | 10/5/2024 |
8.4.0 | 102 | 10/5/2024 |
Version 9.0.0
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
- REMOVED Support for TFM .NET 6 (LTS)
Version 8.4.0
Availability: .NET 8 and .NET 6
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version 8.3.2
Availability: .NET 8 and .NET 6
# ALM
- REMOVED Support for TFM .NET 7 (STS)
Version 8.2.0
Availability: .NET 8, .NET 7 and .NET 6
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 8.1.0
Availability: .NET 8, .NET 7 and .NET 6
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 8.0.1
Availability: .NET 8, .NET 7 and .NET 6
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 8.0.0
Availability: .NET 8, .NET 7 and .NET 6
# ALM
- ADDED TFM for net8.0
- REMOVED TFM for netstandard2.0
- CHANGED Dependencies to latest and greatest with respect to TFMs