Class CspNonceServiceExtensions
Extension methods for ICspNonceService.
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class CspNonceServiceExtensions
Methods
View SourceGetNonceAttribute(ICspNonceService)
Gets a nonce attribute for the current request, ready to be written into a tag.
Declaration
public static string GetNonceAttribute(this ICspNonceService cspNonceService)
Parameters
| Type | Name | Description |
|---|---|---|
| ICspNonceService | cspNonceService | The CSP nonce service. |
Returns
| Type | Description |
|---|---|
| string | The attribute including a leading space (for example |
Remarks
The nonce is HTML encoded, as ICspNonceService can be replaced and the returned attribute is written into markup without further encoding.