PermissionsPolicyDirectiveBuilder

We found 10 examples in language CSharp for this search. You will see 20 fragments of code.

Other methods

namespace MVCBlog.Web.Infrastructure.Mvc.SecurityHeaders;

public class PermissionsPolicySettings
{
    public PermissionsPolicyDirectiveBuilder Accelerometer { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder AmbientLightSensor { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Autoplay { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Camera { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder DisplayCapture { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder DocumentDomain { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder EncryptedMedia { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder ExecutionWhileNotRendered { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder ExecutionWhileOutOfViewport { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Fullscreen { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Geolocation { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Gyroscope { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Magnetometer { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Microphone { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Midi { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Payment { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder PictureInPicture { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder PublickeyCredentials { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Speaker { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder SyncXhr { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder Usb { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder WakeLock { get; } = new PermissionsPolicyDirectiveBuilder();

    public PermissionsPolicyDirectiveBuilder XR { get; } = new PermissionsPolicyDirectiveBuilder();
}


    public PermissionsPolicyDirectiveBuilder AllowSelf() => this.Allow("self");

    public PermissionsPolicyDirectiveBuilder AllowNone() => this.Allow(string.Empty);

    public PermissionsPolicyDirectiveBuilder AllowAny() => this.Allow("*");

    public PermissionsPolicyDirectiveBuilder Allow(string source)
    {
        this.Sources.Add(source);
        return this;
    }


        /// <summary>
        /// Enable the feature in top-level browsing contexts and all nested browsing contexts (iframes).
        /// </summary>
        /// <returns>The Permissions-Policy builder for method chaining</returns>
        public PermissionsPolicyDirectiveBuilder All()
        {
            AllowAllResources = true;
            return this;
        }

        /// <summary>
        /// Enable the feature in top-level browsing contexts and all nested browsing contexts (iframes) in the same origin. ]
        /// The feature is not allowed in cross-origin documents in nested browsing contexts.
        /// </summary>
        /// <returns>The Permissions-Policy builder for method chaining</returns>
        public PermissionsPolicyDirectiveBuilder Self()
        {
            Sources.Add("self");
            return this;
        }

        /// <summary>
        /// The feature is disabled in top-level and nested browsing contexts.
        /// </summary>
        /// <returns>The Permissions-Policy builder for method chaining</returns>
        public PermissionsPolicyDirectiveBuilder None()
        {
            BlockResources = true;
            return this;
        }

    /// <summary>
    ///     Adds the <c>xr-spatial-tracking</c> permission to the Permission-Policy header.
    /// </summary>
    /// <param name="permissionsPolicyBuilder">A <see cref="PermissionsPolicyBuilder" /> to add the permission to.</param>
    /// <returns>The permissionsPolicyBuilder that was passed as this.</returns>
    public static PermissionsPolicyDirectiveBuilder AddXrSpatialTracking(
        this PermissionsPolicyBuilder permissionsPolicyBuilder)
    {
        return permissionsPolicyBuilder.AddCustomFeature("xr-spatial-tracking");
    }


        /// <summary>
        /// Controls whether the current document is allowed to use the accelerometer sensor.
        /// If disabled then constructing of a Sensor-based interface object will throw a
        /// <code>SecurityError</code>. The events are not fired. If an interface (or an
        /// event) requires access to multiple sensors of different types than each of the
        /// corresponding sensor features must be allowed in order to use the interface.
        /// </summary>
        /// <returns>A configured <see cref="AccelerometerPermissionsPolicyDirectiveBuilder"/></returns>
        public AccelerometerPermissionsPolicyDirectiveBuilder AddAccelerometer() => AddDirective(new AccelerometerPermissionsPolicyDirectiveBuilder());

        /// <summary>
        /// Controls whether the current document is allowed to use the ambient light sensor sensor.
        /// If disabled then constructing of a Sensor-based interface object will throw a
        /// <code>SecurityError</code>. The events are not fired. If an interface (or an
        /// event) requires access to multiple sensors of different types than each of the
        /// corresponding sensor features must be allowed in order to use the interface.
        /// </summary>
        /// <returns>A configured <see cref="AmbientLightSensorPermissionsPolicyDirectiveBuilder"/></returns>
        public AmbientLightSensorPermissionsPolicyDirectiveBuilder AddAmbientLightSensor() => AddDirective(new AmbientLightSensorPermissionsPolicyDirectiveBuilder());

        /// <summary>
        /// Controls access to autoplay of media requested through the
        /// <code>HTMLMediaElement</code> interface. If disabled in a document,
        /// then calls to <code>play()</code> without a user gesture will
        /// reject the promise with a <code>NotAllowedError</code> DOMException
        /// object as its parameter. The autoplay attribute will be ignored.
        /// </summary>
        /// <returns>A configured <see cref="AutoplayPermissionsPolicyDirectiveBuilder"/></returns>
        public AutoplayPermissionsPolicyDirectiveBuilder AddAutoplay() => AddDirective(new AutoplayPermissionsPolicyDirectiveBuilder());

        /// <summary>
        /// Controls access to video input devices requested through the
        /// NavigatorUserMedia interface. If disabled in a document, then calls
        /// to <code>getUserMedia()</code> will not grant access to video input
        /// devices in that document.
        /// </summary>
        /// <returns>A configured <see cref="CameraPermissionsPolicyDirectiveBuilder"/></returns>
        public CameraPermissionsPolicyDirectiveBuilder AddCamera() => AddDirective(new CameraPermissionsPolicyDirectiveBuilder());

        /// <summary>
        /// Controls whether encrypted media extensions are available. If disabled
        /// The promise returned by <code>requestMediaKeySystemAccess()</code> must
        /// return a promise which rejects with a <code>SecurityError</code> DOMException
        /// object as its parameter.
        /// </summary>
        /// <returns>A configured <see cref="EncryptedMediaPermissionsPolicyDirectiveBuilder"/></returns>
        public EncryptedMediaPermissionsPolicyDirectiveBuilder AddEncryptedMedia() => AddDirective(new EncryptedMediaPermissionsPolicyDirectiveBuilder());

        /// <summary>
        /// Controls whether the current document is allowed to use
        /// <code>Element.requestFullScreen()</code>. When this policy is enabled,
        /// the returned <code>Promise</code> rejects with a <code>TypeError</code>.
        /// </summary>
        /// <returns>A configured <see cref="FullscreenPermissionsPolicyDirectiveBuilder"/></returns>
        public FullscreenPermissionsPolicyDirectiveBuilder AddFullscreen() => AddDirective(new FullscreenPermissionsPolicyDirectiveBuilder());

namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy
{
    /// <summary>
    /// Controls  whether the current document is allowed to use the
    /// PaymentRequest interface. If disabled then calls to the
    /// <code>PaymentRequest</code> constuctor will throw a <code>SecurityError</code>.
    /// </summary>
    public class PaymentPermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilder
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PaymentPermissionsPolicyDirectiveBuilder"/> class.
        /// </summary>
        public PaymentPermissionsPolicyDirectiveBuilder() : base("payment")
        {
        }
    }
}

namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy
{
    /// <summary>
    /// Controls whether the current document is allowed to use the WebVR API.
    /// If disabled then calls to <code>getVRDisplays()</code> should return a
    /// <code>promise</code> which rejects with a <code>SecurityError</code> DOMException.
    /// </summary>
    public class VRPermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilder
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="VRPermissionsPolicyDirectiveBuilder"/> class.
        /// </summary>
        public VRPermissionsPolicyDirectiveBuilder() : base("vr")
        {
        }
    }
}

namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy
{
    /// <summary>
    /// Controls whether the current document is allowed to use the Web MIDI API.
    /// If disabled in a document, the promise returned by <code>requestMIDIAccess()</code>
    /// must reject with a DOMException parameter.
    /// </summary>
    public class MidiPermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilder
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MidiPermissionsPolicyDirectiveBuilder"/> class.
        /// </summary>
        public MidiPermissionsPolicyDirectiveBuilder() : base("midi")
        {
        }
    }
}

namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy
{
    /// <summary>
    /// Controls access to video input devices requested through the
    /// NavigatorUserMedia interface. If disabled in a document, then calls
    /// to <code>getUserMedia()</code> will not grant access to video input
    /// devices in that document.
    /// </summary>
    public class CameraPermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilder
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CameraPermissionsPolicyDirectiveBuilder"/> class.
        /// </summary>
        public CameraPermissionsPolicyDirectiveBuilder() : base("camera")
        {
        }
    }
}

namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy
{
    /// <summary>
    /// Controls whether the current document is allowed to use the WebUSB API.
    /// If disabled then calls to <code>getDevices()</code> should return a
    /// <code>promise</code> which rejects with a <code>SecurityError</code> DOMException.
    /// </summary>
    public class UsbPermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilder
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="UsbPermissionsPolicyDirectiveBuilder"/> class.
        /// </summary>
        public UsbPermissionsPolicyDirectiveBuilder() : base("usb")
        {
        }
    }
}

NetEscapades.AspNetCore.SecurityHeaders.Headers.PermissionsPolicy.PermissionsPolicyDirectiveBuilder : PermissionsPolicyDirectiveBuilderBase

Constructors :

public PermissionsPolicyDirectiveBuilder(String directive = )

Methods :

public List<String> get_Sources()
public PermissionsPolicyDirectiveBuilder All()
public PermissionsPolicyDirectiveBuilder Self()
public PermissionsPolicyDirectiveBuilder None()
public PermissionsPolicyDirectiveBuilder For(String uri = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods