-
Notifications
You must be signed in to change notification settings - Fork 3
/
Aws4HmacAuthorizationHeader.cs
42 lines (40 loc) · 2.23 KB
/
Aws4HmacAuthorizationHeader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using Cuemon.AspNetCore.Authentication;
using Cuemon.AspNetCore.Authentication.Hmac;
namespace Cuemon.Extensions.AspNetCore.Authentication.AwsSignature4
{
/// <summary>
/// Provides a representation of a HTTP AWS4-HMAC-SHA256 Authentication header.
/// </summary>
/// <seealso cref="HmacAuthorizationHeader" />
public class Aws4HmacAuthorizationHeader : HmacAuthorizationHeader
{
/// <summary>
/// Creates an instance of <see cref="Aws4HmacAuthorizationHeader"/> from the specified parameters.
/// </summary>
/// <param name="authorizationHeader">The raw HTTP authorization header.</param>
/// <param name="setup">The <see cref="AuthorizationHeaderOptions" /> which may be configured.</param>
/// <returns>An instance of <see cref="Aws4HmacAuthorizationHeader"/>.</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="authorizationHeader"/> cannot be null.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="authorizationHeader"/> cannot be empty or consist only of white-space characters.
/// </exception>
public static HmacAuthorizationHeader Create(string authorizationHeader, Action<AuthorizationHeaderOptions> setup = null)
{
Validator.ThrowIfNullOrWhitespace(authorizationHeader);
return Create(Aws4HmacFields.Scheme, authorizationHeader, setup);
}
/// <summary>
/// Initializes a new instance of the <see cref="Aws4HmacAuthorizationHeader"/> class.
/// </summary>
/// <param name="clientId">The client identifier that is the public key of the signing process.</param>
/// <param name="credentialScope">The credential scope that defines the remote resource.</param>
/// <param name="signedHeaders">The headers that will be part of the signing process.</param>
/// <param name="signature">The signature that represents the integrity of this header.</param>
public Aws4HmacAuthorizationHeader(string clientId, string credentialScope, string signedHeaders, string signature) : base(clientId, credentialScope, signedHeaders, signature, Aws4HmacFields.Scheme)
{
}
}
}