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
optionsIOptions<ImageSharpMiddlewareOptions>The middleware configuration options.
authorizationUtilitiesRequestAuthorizationUtilitiesContains helpers that allow authorization of image requests.
urlHelperFactoryIUrlHelperFactoryThe URL helper factory.
htmlEncoderHtmlEncoderThe 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
Remarks
Default order is 0.
Src
Gets or sets the source of the image.
[HtmlAttributeName("src")]
public string? Src { get; set; }
Property Value
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
contextTagHelperContextContains information associated with the current HTML tag.
outputTagHelperOutputA stateful HTML element used to generate an HTML tag.