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
[DataContract(Namespace = "http://schemas.nevatech.com/sentinet/2011/02")]
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
[DataMember(EmitDefaultValue = false)]
public bool AllowCredentials { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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
[DataMember(EmitDefaultValue = false)]
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
[DataMember]
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
[DataMember]
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
[DataMember(EmitDefaultValue = false)]
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
[DataMember(EmitDefaultValue = false)]
public int PreflightMaxAge { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
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 |
|---|---|
| bool | 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | 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 |
|---|---|
| int | 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | True if state is valid; otherwise, false. |