Table of Contents

Class HmacAuthorizationHeaderBuilder

Namespace
Cuemon.AspNetCore.Authentication.Hmac
Assembly
Cuemon.AspNetCore.Authentication.dll

Provides a way to fluently represent a HTTP HMAC Authentication header.

public class HmacAuthorizationHeaderBuilder : HmacAuthorizationHeaderBuilder<HmacAuthorizationHeaderBuilder>
Inheritance
HmacAuthorizationHeaderBuilder
Inherited Members

Constructors

HmacAuthorizationHeaderBuilder(String, KeyedCryptoAlgorithm, UnkeyedCryptoAlgorithm)

Initializes a new instance of the HmacAuthorizationHeaderBuilder class.

public HmacAuthorizationHeaderBuilder(string authenticationScheme = "HMAC", KeyedCryptoAlgorithm hmacAlgorithm = KeyedCryptoAlgorithm.HmacSha256, UnkeyedCryptoAlgorithm algorithm = UnkeyedCryptoAlgorithm.Sha256)

Parameters

authenticationScheme String

The name of the authentication scheme. Default is HMAC.

hmacAlgorithm KeyedCryptoAlgorithm

The algorithm to use when computing the final signature of the HMAC Authentication header.

algorithm UnkeyedCryptoAlgorithm

The algorithm to use when computing in-between signatures as part of the final signing of the HMAC Authentication header.

Properties

Algorithm

Gets the non-keyed algorithm of the HTTP HMAC Authentication.

public UnkeyedCryptoAlgorithm Algorithm { get; }

Property Value

UnkeyedCryptoAlgorithm

The non-keyed algorithm of the HTTP HMAC Authentication.

HmacAlgorithm

Gets the keyed algorithm of the HTTP HMAC Authentication.

public KeyedCryptoAlgorithm HmacAlgorithm { get; }

Property Value

KeyedCryptoAlgorithm

The keyed algorithm of the HTTP HMAC Authentication.

Methods

AddCredentialScope(String)

Adds the credential scope that defines the remote resource.

public HmacAuthorizationHeaderBuilder AddCredentialScope(string credentialScope)

Parameters

credentialScope String

The credential scope that defines the remote resource.

Returns

HmacAuthorizationHeaderBuilder

A reference to this instance so that additional calls can be chained.

AddFromRequest(HttpRequest)

Adds the necessary fields that is part of an HTTP request.

public override HmacAuthorizationHeaderBuilder AddFromRequest(HttpRequest request)

Parameters

request HttpRequest

An instance of the Microsoft.AspNetCore.Http.HttpRequest object.

Returns

HmacAuthorizationHeaderBuilder

A reference to this instance so that additional calls can be chained.

AddFromRequest(HttpRequestMessage)

Adds the necessary fields that is part of an HTTP request.

public HmacAuthorizationHeaderBuilder AddFromRequest(HttpRequestMessage request)

Parameters

request HttpRequestMessage

An instance of the HttpRequestMessage object.

Returns

HmacAuthorizationHeaderBuilder

A reference to this instance so that additional calls can be chained.

Build()

Builds an instance of HmacAuthorizationHeader that implements AuthorizationHeader.

public override HmacAuthorizationHeader Build()

Returns

HmacAuthorizationHeader

An instance of HmacAuthorizationHeader.

ComputeCanonicalRequest()

Converts the request to a standardized (canonical) format and computes a message digest.

public override string ComputeCanonicalRequest()

Returns

String

A String representation, in hexadecimal, of the computed canonical request.

ComputeSignature()

Computes the signature of this instance using a series of hash-based message authentication codes (HMACs).

public override string ComputeSignature()

Returns

String

A String representation, in hexadecimal, of the computed signature of this instance.