Class CorsSettings
Provides configuration settings for the Cross-Origin Resource Sharing protocol enabled for a service endpoint.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Entities
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class CorsSettings : IValidator, IEquatable<CorsSettings>, IExtensibleDataObject
Constructors
CorsSettings()
Initializes new instance with default settings.
Declaration
public CorsSettings()
CorsSettings(CorsElement)
Initializes new instance from the provided configuration element.
Declaration
public CorsSettings(CorsElement element)
Parameters
Type | Name | Description |
---|---|---|
CorsElement | element | Configuration element to be initialized from. |
Properties
AllowCredentials
Gets or sets the flag indicating whether the resource supports user credentials in the request. It is true when the resource does and false otherwise.
Declaration
public bool AllowCredentials { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
AllowedHeaders
Gets or sets the list of HTTP headers consisting of zero or more header field names that are supported by the resource. A wildcard (*) can be used to allow all headers.
Declaration
public string AllowedHeaders { get; set; }
Property Value
Type | Description |
---|---|
String |
AllowedMethods
Gets or sets the list of methods consisting of one or more HTTP methods that are supported by the resource. A wildcard (*) can be used to allow all methods. If property is Null or empty then CORS preflight requests are not supported.
Declaration
public string AllowedMethods { get; set; }
Property Value
Type | Description |
---|---|
String |
AllowedOrigins
Gets or sets the list of origins consisting of one or more URIs that are allowed access to the resource. A wildcard (*) can be used to allow access to all origins.
Declaration
public string AllowedOrigins { get; set; }
Property Value
Type | Description |
---|---|
String |
ErrorMessage
Gets the summary of validation errors.
Declaration
public string ErrorMessage { get; }
Property Value
Type | Description |
---|---|
String |
ExposedHeaders
Gets or sets the list of exposed headers consisting of zero or more header field names of headers that the resource might use and can be exposed.
Declaration
public string ExposedHeaders { get; set; }
Property Value
Type | Description |
---|---|
String |
ExtensionData
Gets or sets ExtensionDataObject that enables serialization roundtrips.
Declaration
public ExtensionDataObject ExtensionData { get; set; }
Property Value
Type | Description |
---|---|
ExtensionDataObject |
PreflightMaxAge
Gets or sets the number of secords indicating how long the results of a preflight request can be cached on a client in a preflight result cache. Value must be positive.
Declaration
public int PreflightMaxAge { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AreHeadersAllowed(String)
Checks if provided HTTP header names are in the list of allowed values.
Declaration
public bool AreHeadersAllowed(string headers)
Parameters
Type | Name | Description |
---|---|---|
String | headers | Comma-separated list of HTTP header names to be verified. |
Returns
Type | Description |
---|---|
Boolean | True, if all provided HTTP headers are allowed to be passed in the service call. False, otherwise. |
Equals(CorsSettings)
Determines whether the specified instance is equal to the current instance.
Declaration
public bool Equals(CorsSettings other)
Parameters
Type | Name | Description |
---|---|---|
CorsSettings | other | The instance to compare with the current instance. |
Returns
Type | Description |
---|---|
Boolean | True, if instances are equal. False, if instances are not equal. |
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | True, if objects are equal. False, if objects are not equal. |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Hash code of the current instance. |
Overrides
IsMethodAllowed(String)
Checks if provided HTTP method is in the list of allowed values.
Declaration
public bool IsMethodAllowed(string method)
Parameters
Type | Name | Description |
---|---|---|
String | method | HTTP method to be verified. |
Returns
Type | Description |
---|---|
Boolean | True, if provided HTTP method is allowed for calling the service. False, otherwise. |
IsOriginAllowed(String)
Checks if provided Origin is in the list of allowed values.
Declaration
public bool IsOriginAllowed(string origin)
Parameters
Type | Name | Description |
---|---|---|
String | origin | Origin to be verified. |
Returns
Type | Description |
---|---|
Boolean | True, if provided Origin is allowed for calling the service. False, otherwise. |
Validate()
Evaluates the state of this object.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if state is valid; otherwise, false. |