Class HmacAuthorizationHeaderBuilder
- 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
StringThe name of the authentication scheme. Default is HMAC.
hmacAlgorithm
KeyedCryptoAlgorithmThe algorithm to use when computing the final signature of the HMAC Authentication header.
algorithm
UnkeyedCryptoAlgorithmThe 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
StringThe 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
HttpRequestAn 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
HttpRequestMessageAn 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()