Search Results for

    Show / Hide Table of Contents
    View Source

    Class AspNetCoreCspNonceService

    ASP.NET Core implementation of ICspNonceService that generates and caches a cryptographically secure nonce per HTTP request.

    Inheritance
    object
    Namespace: Umbraco.Cms.Web.Common.Security
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public class AspNetCoreCspNonceService : ICspNonceService

    Constructors

    View Source

    AspNetCoreCspNonceService(IHttpContextAccessor)

    Initializes a new instance of the AspNetCoreCspNonceService class.

    Declaration
    public AspNetCoreCspNonceService(IHttpContextAccessor httpContextAccessor)
    Parameters
    Type Name Description
    IHttpContextAccessor httpContextAccessor

    The HTTP context accessor.

    Methods

    View Source

    GetNonce()

    Gets the CSP nonce for the current request (generates once, caches per-request). Returns null if no HTTP context is available.

    Declaration
    public string? GetNonce()
    Returns
    Type Description
    string

    The CSP nonce value, or null if no HTTP context is available.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX