Class HmacTokenTagHelper
A TagHelper implementation targeting <img> element that allows the automatic generation of HMAC image processing protection tokens.
Inherited Members
Namespace: SixLabors.ImageSharp.Web.TagHelpers
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
[HtmlTargetElement("img", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)]
public class HmacTokenTagHelper : UrlResolutionTagHelper, ITagHelper, ITagHelperComponent
Constructors
HmacTokenTagHelper(IOptions<ImageSharpMiddlewareOptions>, RequestAuthorizationUtilities, IUrlHelperFactory, HtmlEncoder)
Initializes a new instance of the HmacTokenTagHelper class.
Declaration
public HmacTokenTagHelper(IOptions<ImageSharpMiddlewareOptions> options, RequestAuthorizationUtilities authorizationUtilities, IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<ImageSharpMiddlewareOptions> | options | The middleware configuration options. |
| RequestAuthorizationUtilities | authorizationUtilities | Contains helpers that allow authorization of image requests. |
| IUrlHelperFactory | urlHelperFactory | 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.
Declaration
public override int Order { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Remarks
Default order is 0.
Src
Gets or sets the source of the image.
Declaration
[HtmlAttributeName("src")]
public string? Src { get; set; }
Property Value
| Type | Description |
|---|---|
| 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.
Declaration
public override void Process(TagHelperContext context, TagHelperOutput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TagHelperContext | context | Contains information associated with the current HTML tag. |
| TagHelperOutput | output | A stateful HTML element used to generate an HTML tag. |