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
optionsIOptions<ImageSharpMiddlewareOptions>The middleware configuration options.
requestParserIRequestParserAn IRequestParser instance used to parse image requests for commands.
processorsIEnumerable<IImageWebProcessor>A collection of IImageWebProcessor instances used to process images.
commandParserCommandParserThe command parser.
serviceProviderIServiceProviderThe 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
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
hostHostStringThe host header.
pathPathStringThe path or pathbase.
queryStringQueryStringThe querystring.
queryQueryCollectionThe query collection.
handlingCommandHandlingThe 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
hostHostStringThe host header.
pathPathStringThe path or pathbase.
queryStringQueryStringThe querystring.
handlingCommandHandlingThe 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
contextHttpContextThe request HTTP context.
handlingCommandHandlingThe 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
uristringThe uri to compute the code from.
handlingCommandHandlingThe 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
uriUriThe uri to compute the code from.
handlingCommandHandlingThe command collection handling.
Returns
- string
The computed HMAC.
StripUnknownCommands(CommandCollection)
Strips any unknown commands from the command collection.
public void StripUnknownCommands(CommandCollection commands)
Parameters
commandsCommandCollectionThe unsanitized command collection.