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
authenticationSchemestringThe name of the authentication scheme. Default is HMAC.
hmacAlgorithmKeyedCryptoAlgorithmThe algorithm to use when computing the final signature of the HMAC Authentication header.
algorithmUnkeyedCryptoAlgorithmThe 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
credentialScopestringThe 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
requestHttpRequestAn instance of the 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
requestHttpRequestMessageAn 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
ComputeSignature()
Computes the signature of this instance using a series of hash-based message authentication codes (HMACs).
public override string ComputeSignature()