Table of Contents

Class HmacTokenTagHelper

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

A TagHelper implementation targeting <img> element that allows the automatic generation of HMAC image processing protection tokens.

[HtmlTargetElement("img", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)]
public class HmacTokenTagHelper : UrlResolutionTagHelper, ITagHelper, ITagHelperComponent
Inheritance
HmacTokenTagHelper
Implements
Inherited Members

Constructors

HmacTokenTagHelper(IOptions<ImageSharpMiddlewareOptions>, RequestAuthorizationUtilities, IUrlHelperFactory, HtmlEncoder)

Initializes a new instance of the HmacTokenTagHelper class.

public HmacTokenTagHelper(IOptions<ImageSharpMiddlewareOptions> options, RequestAuthorizationUtilities authorizationUtilities, IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder)

Parameters

options IOptions<ImageSharpMiddlewareOptions>

The middleware configuration options.

authorizationUtilities RequestAuthorizationUtilities

Contains helpers that allow authorization of image requests.

urlHelperFactory IUrlHelperFactory

The URL helper factory.

htmlEncoder HtmlEncoder

The HTML encoder.

Properties

Order

When a set of ITagHelpers are executed, their Init(TagHelperContext)'s are first invoked in the specified Order; then their ProcessAsync(TagHelperContext, TagHelperOutput)'s are invoked in the specified Order. Lower values are executed first.

public override int Order { get; }

Property Value

int

Remarks

Default order is 0.

Src

Gets or sets the source of the image.

[HtmlAttributeName("src")]
public string? Src { get; set; }

Property Value

string

Remarks

Passed through to the generated HTML in all cases.

Methods

Process(TagHelperContext, TagHelperOutput)

Synchronously executes the TagHelper with the given context and output.

public override void Process(TagHelperContext context, TagHelperOutput output)

Parameters

context TagHelperContext

Contains information associated with the current HTML tag.

output TagHelperOutput

A stateful HTML element used to generate an HTML tag.