Class ContentSecurityPolicySourceListBuilder
The source list builder for Content Security Policy directives.
Inheritance
Inherited Members
Namespace: Lib.AspNetCore.Security.Http.Headers
Assembly: Lib.AspNetCore.Security.dll
Syntax
public class ContentSecurityPolicySourceListBuilder
Methods
Build()
Builds a new source list using the settings added.
Declaration
public string Build()
Returns
Type | Description |
---|---|
System.String | The constructed source list. |
WithBlobSchema()
Adds the schema to match all blob: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithBlobSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithDataSchema()
Adds the schema to match all data: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithDataSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithFilesystemSchema()
Adds the schema to match all filesystem: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithFilesystemSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithHttpSchema()
Adds the schema to match all http: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithHttpSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithHttpsSchema()
Adds the schema to match all https: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithHttpsSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithMediastreamSchema()
Adds the schema to match all mediastream: origins.
Declaration
public ContentSecurityPolicySourceListBuilder WithMediastreamSchema()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithSchemas(String[])
Adds the schemas.
Declaration
public ContentSecurityPolicySourceListBuilder WithSchemas(params string[] schemas)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | schemas | The schemas. |
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithSelfKeyword()
Adds the keyword to match current URL’s origin.
Declaration
public ContentSecurityPolicySourceListBuilder WithSelfKeyword()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithStrictDynamicKeyword()
Adds the keyword which specifies that the trust explicitly given to a resource present in the markup, by accompanying it with a nonce or a hash, shall be propagated to all the recources loaded by that root resource. At the same time, any whitelist or source expressions such as 'self' or 'unsafe-inline' will be ignored.
Declaration
public ContentSecurityPolicySourceListBuilder WithStrictDynamicKeyword()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithUnsafeEvalKeyword()
Adds the keyword to allow the use of eval() and similar methods for creating code from strings.
Declaration
public ContentSecurityPolicySourceListBuilder WithUnsafeEvalKeyword()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithUnsafeInlineKeyword()
Adds the keyword to allow the use of inline resources.
Declaration
public ContentSecurityPolicySourceListBuilder WithUnsafeInlineKeyword()
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |
WithUrls(String[])
Adds the URLs.
Declaration
public ContentSecurityPolicySourceListBuilder WithUrls(params string[] urls)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | urls | The URLs. |
Returns
Type | Description |
---|---|
ContentSecurityPolicySourceListBuilder | The current source list builder. |