CorsPolicyBuilder CorsPolicyBuilder CorsPolicyBuilder Class

Definition

Exposes methods to build a policy.

public class CorsPolicyBuilder
type CorsPolicyBuilder = class
Public Class CorsPolicyBuilder
Inheritance
CorsPolicyBuilderCorsPolicyBuilderCorsPolicyBuilder

Constructors

CorsPolicyBuilder(CorsPolicy) CorsPolicyBuilder(CorsPolicy) CorsPolicyBuilder(CorsPolicy)

Creates a new instance of the CorsPolicyBuilder.

CorsPolicyBuilder(String[]) CorsPolicyBuilder(String[]) CorsPolicyBuilder(String[])

Creates a new instance of the CorsPolicyBuilder.

Methods

AllowAnyHeader() AllowAnyHeader() AllowAnyHeader()

Ensures that the policy allows any header.

AllowAnyMethod() AllowAnyMethod() AllowAnyMethod()

Ensures that the policy allows any method.

AllowAnyOrigin() AllowAnyOrigin() AllowAnyOrigin()

Ensures that the policy allows any origin.

AllowCredentials() AllowCredentials() AllowCredentials()

Sets the policy to allow credentials.

Build() Build() Build()

Builds a new CorsPolicy using the entries added.

DisallowCredentials() DisallowCredentials() DisallowCredentials()

Sets the policy to not allow credentials.

SetIsOriginAllowed(Func<String,Boolean>) SetIsOriginAllowed(Func<String,Boolean>) SetIsOriginAllowed(Func<String,Boolean>)

Sets the specified isOriginAllowed for the underlying policy.

SetIsOriginAllowedToAllowWildcardSubdomains() SetIsOriginAllowedToAllowWildcardSubdomains() SetIsOriginAllowedToAllowWildcardSubdomains()

Sets the IsOriginAllowed property of the policy to be a function that allows origins to match a configured wildcarded domain when evaluating if the origin is allowed.

SetPreflightMaxAge(TimeSpan) SetPreflightMaxAge(TimeSpan) SetPreflightMaxAge(TimeSpan)

Sets the preflightMaxAge for the underlying policy.

WithExposedHeaders(String[]) WithExposedHeaders(String[]) WithExposedHeaders(String[])

Adds the specified exposedHeaders to the policy.

WithHeaders(String[]) WithHeaders(String[]) WithHeaders(String[])

Adds the specified headers to the policy.

WithMethods(String[]) WithMethods(String[]) WithMethods(String[])

Adds the specified methods to the policy.

WithOrigins(String[]) WithOrigins(String[]) WithOrigins(String[])

Adds the specified origins to the policy.

Applies to