Class UserAgentSentinelOptions
Configuration options for UserAgentSentinelMiddleware.
Inheritance
Namespace: Cuemon.AspNetCore.Http.Headers
Assembly: Cuemon.AspNetCore.dll
Syntax
public class UserAgentSentinelOptions
Constructors
| Improve this DocUserAgentSentinelOptions()
Initializes a new instance of the UserAgentSentinelOptions class.
Declaration
public UserAgentSentinelOptions()
Remarks
The following table shows the initial property values for an instance of UserAgentSentinelOptions.
Property | Initial Value |
---|---|
AllowedUserAgents | new List{string{>}(); |
BadRequestMessage | The requirements of the HTTP User-Agent header was not met. |
ForbiddenMessage | The HTTP User-Agent specified was rejected. |
RequireUserAgentHeader | false |
ValidateUserAgentHeader | false |
ResponseBroker | A System.Net.Http.HttpResponseMessage initialized to either a HTTP status code 400 or 403 and a body of either BadRequestMessage or ForbiddenMessage. |
UseGenericResponse | false |
Properties
| Improve this DocAllowedUserAgents
Gets a list of whitelisted user agents.
Declaration
public IList<string> AllowedUserAgents { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> | A list of whitelisted user agents. |
BadRequestMessage
Gets or sets the message of a request missing the requirements of a User-Agent header.
Declaration
public string BadRequestMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String | The message of a request missing the requirements of a User-Agent header. |
ForbiddenMessage
Gets or sets the message of a request without a valid User-Agent header.
Declaration
public string ForbiddenMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String | The message of a request without a valid User-Agent header. |
RequireUserAgentHeader
Gets or sets a value indicating whether a HTTP User-Agent header must be present in the request.
Declaration
public bool RequireUserAgentHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ResponseBroker
Gets or sets the function delegate that configures the response in the form of a System.Net.Http.HttpResponseMessage.
Declaration
public Func<string, HttpResponseMessage> ResponseBroker { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.String, System.Net.Http.HttpResponseMessage> | The function delegate that configures the response in the form of a System.Net.Http.HttpResponseMessage. |
UseGenericResponse
Gets or sets a value indicating whether the produced ResponseBroker should be as neutral as possible.
Declaration
public bool UseGenericResponse { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ValidateUserAgentHeader
Gets or sets a value indicating whether a HTTP User-Agent header must be validated against AllowedUserAgents.
Declaration
public bool ValidateUserAgentHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|