Table of Contents

Class ThrottlingSentinelAttribute

Namespace
Cuemon.AspNetCore.Mvc.Filters.Throttling
Assembly
Cuemon.AspNetCore.Mvc.dll

Represents an attribute that is used to mark an action method to be protected by a throttling sentinel.

public abstract class ThrottlingSentinelAttribute : ActionFilterAttribute, IActionFilter, IAsyncActionFilter, IResultFilter, IAsyncResultFilter, IOrderedFilter, IFilterFactory, IFilterMetadata
Inheritance
Object
Attribute
ActionFilterAttribute
ThrottlingSentinelAttribute
Implements
IActionFilter
IAsyncActionFilter
IResultFilter
IAsyncResultFilter
IOrderedFilter
IFilterFactory
IFilterMetadata
Inherited Members
ActionFilterAttribute.OnActionExecuting(ActionExecutingContext)
ActionFilterAttribute.OnActionExecuted(ActionExecutedContext)
ActionFilterAttribute.OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate)
ActionFilterAttribute.OnResultExecuting(ResultExecutingContext)
ActionFilterAttribute.OnResultExecuted(ResultExecutedContext)
ActionFilterAttribute.OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate)
ActionFilterAttribute.Order
Attribute.Equals(Object)
Attribute.GetCustomAttribute(Assembly, Type)
Attribute.GetCustomAttribute(Assembly, Type, Boolean)
Attribute.GetCustomAttribute(MemberInfo, Type)
Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
Attribute.GetCustomAttribute(Module, Type)
Attribute.GetCustomAttribute(Module, Type, Boolean)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
Attribute.GetCustomAttributes(Assembly)
Attribute.GetCustomAttributes(Assembly, Boolean)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, Boolean)
Attribute.GetCustomAttributes(MemberInfo)
Attribute.GetCustomAttributes(MemberInfo, Boolean)
Attribute.GetCustomAttributes(MemberInfo, Type)
Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
Attribute.GetCustomAttributes(Module)
Attribute.GetCustomAttributes(Module, Boolean)
Attribute.GetCustomAttributes(Module, Type)
Attribute.GetCustomAttributes(Module, Type, Boolean)
Attribute.GetCustomAttributes(ParameterInfo)
Attribute.GetCustomAttributes(ParameterInfo, Boolean)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
Attribute.GetHashCode()
Attribute.IsDefaultAttribute()
Attribute.IsDefined(Assembly, Type)
Attribute.IsDefined(Assembly, Type, Boolean)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, Boolean)
Attribute.IsDefined(Module, Type)
Attribute.IsDefined(Module, Type, Boolean)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, Boolean)
Attribute.Match(Object)
Attribute.TypeId

Constructors

ThrottlingSentinelAttribute(Int32, Double, TimeUnit)

Initializes a new instance of the ThrottlingSentinelAttribute class.

protected ThrottlingSentinelAttribute(int rateLimit, double window, TimeUnit windowUnit)

Parameters

rateLimit Int32

The allowed rate from within a given window.

window Double

The duration of the window.

windowUnit TimeUnit

One of the enumeration values that specifies the time unit of window.

Properties

IsReusable

Gets a value that indicates if the result of Microsoft.AspNetCore.Mvc.Filters.IFilterFactory.CreateInstance(System.IServiceProvider) can be reused across requests.

public bool IsReusable { get; }

Property Value

Boolean

true if this instance is reusable; otherwise, false.

RateLimitHeaderName

Gets or sets the name of the rate limit HTTP header.

public string RateLimitHeaderName { get; set; }

Property Value

String

The name of the rate limit HTTP header.

RateLimitRemainingHeaderName

Gets or sets the name of the rate limit remaining HTTP header.

public string RateLimitRemainingHeaderName { get; set; }

Property Value

String

The name of the rate limit remaining HTTP header.

RateLimitResetHeaderName

Gets or sets the name of the rate limit reset HTTP header.

public string RateLimitResetHeaderName { get; set; }

Property Value

String

The name of the rate limit reset HTTP header.

RateLimitResetScope

Gets or sets the preferred rate limit reset HTTP header value that conforms with RFC 7231.

public RetryConditionScope RateLimitResetScope { get; set; }

Property Value

RetryConditionScope

The preferred rate limit reset HTTP header value that conforms with RFC 7231.

RetryAfterScope

Gets or sets the preferred Retry-After HTTP header value that conforms with RFC 2616.

public RetryConditionScope RetryAfterScope { get; set; }

Property Value

RetryConditionScope

The preferred Retry-After HTTP header value that conforms with RFC 2616.

TooManyRequestsMessage

Gets or sets the message of a throttled request that has exceeded the rate limit.

public string TooManyRequestsMessage { get; set; }

Property Value

String

The message of a throttled request that has exceeded the rate limit.

UseRetryAfterHeader

Gets or sets a value indicating whether to include a Retry-After HTTP header specifying how long to wait before making a new request.

public bool UseRetryAfterHeader { get; set; }

Property Value

Boolean

true to include a Retry-After HTTP header specifying how long to wait before making a new request; otherwise, false.

Methods

CreateInstance(IServiceProvider)

Creates an instance of the executable filter.

public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The request System.IServiceProvider.

Returns

IFilterMetadata

An instance of the executable filter.

UniqueContextResolver(HttpContext)

Resolves a unique context of the throttling middleware (eg. IP-address, Authorization header, etc.).

public abstract string UniqueContextResolver(HttpContext context)

Parameters

context HttpContext

The Microsoft.AspNetCore.Http.HttpContext to extract a unique context from.

Returns

String

A string that uniquely identifies the requester in need of throttling.

See Also

ActionFilterAttribute