Table of Contents

Class RequestAuthorizationUtilities

Namespace
SixLabors.ImageSharp.Web
Assembly
SixLabors.ImageSharp.Web.dll

Contains various helper methods for authorizing image requests.

public sealed class RequestAuthorizationUtilities
Inheritance
RequestAuthorizationUtilities
Inherited Members

Constructors

RequestAuthorizationUtilities(IOptions<ImageSharpMiddlewareOptions>, IRequestParser, IEnumerable<IImageWebProcessor>, CommandParser, IServiceProvider)

Initializes a new instance of the RequestAuthorizationUtilities class.

public RequestAuthorizationUtilities(IOptions<ImageSharpMiddlewareOptions> options, IRequestParser requestParser, IEnumerable<IImageWebProcessor> processors, CommandParser commandParser, IServiceProvider serviceProvider)

Parameters

options IOptions<ImageSharpMiddlewareOptions>

The middleware configuration options.

requestParser IRequestParser

An IRequestParser instance used to parse image requests for commands.

processors IEnumerable<IImageWebProcessor>

A collection of IImageWebProcessor instances used to process images.

commandParser CommandParser

The command parser.

serviceProvider IServiceProvider

The service provider.

Fields

TokenCommand

The command used by image requests for transporting Hash-based Message Authentication Code (HMAC) tokens.

public const string TokenCommand = "hmac"

Field Value

string

Methods

ComputeHMAC(HostString, PathString, QueryString, QueryCollection, CommandHandling)

Compute a Hash-based Message Authentication Code (HMAC) for request authentication.

public string? ComputeHMAC(HostString host, PathString path, QueryString queryString, QueryCollection query, CommandHandling handling)

Parameters

host HostString

The host header.

path PathString

The path or pathbase.

queryString QueryString

The querystring.

query QueryCollection

The query collection.

handling CommandHandling

The command collection handling.

Returns

string

The computed HMAC.

ComputeHMAC(HostString, PathString, QueryString, CommandHandling)

Compute a Hash-based Message Authentication Code (HMAC) for request authentication.

public string? ComputeHMAC(HostString host, PathString path, QueryString queryString, CommandHandling handling)

Parameters

host HostString

The host header.

path PathString

The path or pathbase.

queryString QueryString

The querystring.

handling CommandHandling

The command collection handling.

Returns

string

The computed HMAC.

ComputeHMAC(HttpContext, CommandHandling)

Compute a Hash-based Message Authentication Code (HMAC) for request authentication.

public string? ComputeHMAC(HttpContext context, CommandHandling handling)

Parameters

context HttpContext

The request HTTP context.

handling CommandHandling

The command collection handling.

Returns

string

The computed HMAC.

ComputeHMAC(string, CommandHandling)

Compute a Hash-based Message Authentication Code (HMAC) for request authentication.

public string? ComputeHMAC(string uri, CommandHandling handling)

Parameters

uri string

The uri to compute the code from.

handling CommandHandling

The command collection handling.

Returns

string

The computed HMAC.

ComputeHMAC(Uri, CommandHandling)

Compute a Hash-based Message Authentication Code (HMAC) for request authentication.

public string? ComputeHMAC(Uri uri, CommandHandling handling)

Parameters

uri Uri

The uri to compute the code from.

handling CommandHandling

The command collection handling.

Returns

string

The computed HMAC.

StripUnknownCommands(CommandCollection)

Strips any unknown commands from the command collection.

public void StripUnknownCommands(CommandCollection commands)

Parameters

commands CommandCollection

The unsanitized command collection.