Class HmacAuthorizationHeader
- Namespace
- Cuemon.AspNetCore.Authentication.Hmac
- Assembly
- Cuemon.AspNetCore.Authentication.dll
Provides a representation of a HTTP HMAC Authentication header. Implements the AuthorizationHeader
public class HmacAuthorizationHeader : AuthorizationHeader
- Inheritance
-
HmacAuthorizationHeader
- Inherited Members
Constructors
HmacAuthorizationHeader(string, string, string, string, string)
Initializes a new instance of the HmacAuthorizationHeader class.
public HmacAuthorizationHeader(string clientId, string credentialScope, string signedHeaders, string signature, string authenticationScheme = "HMAC")
Parameters
clientIdstringThe client identifier that is the public key of the signing process.
credentialScopestringThe credential scope that defines the remote resource.
signedHeadersstringThe headers that will be part of the signing process.
signaturestringThe signature that represents the integrity of this header.
authenticationSchemestringThe authentication scheme of this header. Default is Scheme (HMAC).
Properties
ClientId
Gets the client identifier that is the public key of the signing process.
public string ClientId { get; }
Property Value
- string
The client identifier that is the public key of the signing process.
CredentialScope
Gets the credential scope that defines the remote resource.
public string CredentialScope { get; }
Property Value
- string
The credential scope that defines the remote resource.
Signature
Gets the signature that represents the integrity of this header.
public string Signature { get; }
Property Value
- string
The signature that represents the integrity of this header.
SignedHeaders
Gets the headers that will be part of the signing process.
public string[] SignedHeaders { get; }
Property Value
- string[]
The headers that will be part of the signing process.
Methods
Create(string, string, Action<AuthorizationHeaderOptions>)
Creates an instance of HmacAuthorizationHeader from the specified parameters.
public static HmacAuthorizationHeader Create(string authenticationScheme, string authorizationHeader, Action<AuthorizationHeaderOptions> setup = null)
Parameters
authenticationSchemestringThe name of the authentication scheme.
authorizationHeaderstringThe raw HTTP authorization header.
setupAction<AuthorizationHeaderOptions>The AuthorizationHeaderOptions which may be configured.
Returns
- HmacAuthorizationHeader
An instance of HmacAuthorizationHeader.
Exceptions
- ArgumentNullException
authenticationSchemecannot be null -or-authorizationHeadercannot be null.- ArgumentException
authenticationSchemecannot be empty or consist only of white-space characters -or-authorizationHeadercannot be empty or consist only of white-space characters.
ParseCore(IReadOnlyDictionary<string, string>)
The core parser that resolves an AuthorizationHeader from a set of credentials.
protected override AuthorizationHeader ParseCore(IReadOnlyDictionary<string, string> credentials)
Parameters
credentialsIReadOnlyDictionary<string, string>The credentials used in authentication.
Returns
- AuthorizationHeader
An AuthorizationHeader equivalent of
credentials.
ToString()
Returns a string that represents this instance.
public override string ToString()