Cloud.Net.Sdk.Hmac
5.0.1
dotnet add package Cloud.Net.Sdk.Hmac --version 5.0.1
NuGet\Install-Package Cloud.Net.Sdk.Hmac -Version 5.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cloud.Net.Sdk.Hmac" Version="5.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cloud.Net.Sdk.Hmac --version 5.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Cloud.Net.Sdk.Hmac, 5.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cloud.Net.Sdk.Hmac as a Cake Addin #addin nuget:?package=Cloud.Net.Sdk.Hmac&version=5.0.1 // Install Cloud.Net.Sdk.Hmac as a Cake Tool #tool nuget:?package=Cloud.Net.Sdk.Hmac&version=5.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Source: https://github.com/khanhhc2021/hmac
DotNet HMAC Authentication
DotNet HMAC Authentication is a library using for server Authentication HTTP Header and client signing header request. This algorithm base on AWS4 HMAC Authentication.
Installation
Support for dot net core only, version >= 2.2
Install-Package Cloud.Net.Sdk.Hmac
OR
dotnet add package Cloud.Net.Sdk.Hmac
Usage
Authentication
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
//..
services.AddAuthentication(HMACAuthOptions.Scheme).AddScheme<HMACAuthOptions, CustomAuthHandler>(HMACAuthOptions.Scheme, null);
//..
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
//..
app.UseAuthentication();
app.Use(next => context => { context.Request.EnableRewind(); return next(context); });
//..
}
ApiController.cs
[Authorize(AuthenticationSchemes = HMACAuthOptions.Scheme)]
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
//..
}
appsettings.json add this config
"HMAC_KEY_CONFIG": {
"ClientId": "8bf49c695244120399b2c5a00cdbdb9b",
"SecretKey": "1f48072533be925008777c618c71d492de0294f8"
}
Signer
var endpointUri = "https://domaintest.vn/authz/v1/oauth/verifytoken/1";
var restApi = new RestApiHmac<object>();
var result = restApi.DoRequestV2(HttpMethod.GET, endpointUri, _cLientId, _clientSecret, null);
Use Mothod DoRequestV1 if you want response format:
public class ApiJsonResultData<T>
{
public bool Success { get; set; }
public T Data { get; set; }
public string ErrorMessage { get; set; }
}
Use Mothod DoRequestV2 if you want response format:
public class ApiResponse<T>
{
public string Code { get; set; }
public string Message { get; set; }
public T Data { get; set; }
public TokenMetaDataVerifyResponse Metadata { get; set; }
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Microsoft.AspNetCore.Authentication (>= 2.2.0)
- Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2.0)
- Microsoft.AspNetCore.Http.Features (>= 2.2.0)
- Microsoft.Extensions.Configuration (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Configuration.Binder (>= 2.2.4)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Options (>= 2.2.0)
- Newtonsoft.Json (>= 12.0.2)
- System.Text.Encodings.Web (>= 4.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Cloud.Net.Sdk.Hmac:
Package | Downloads |
---|---|
CoreEngine
Package for common blocks when build web service application. |
GitHub repositories
This package is not used by any popular GitHub repositories.