Referencia Pública de API .NETL2 Transversal y FiabilidadEstableAOT: Completo

EricksonLopez.RateLimiting

Zero-allocation rate limiting engine & ASP.NET Core middleware for .NET 8/9/10. In-memory & distributed Redis Lua algorithms with Native AOT & Fail-Open resilience.

4 namespaces39 tipos156 miembrosGenerado desde XML docs y ensamblados · UTC 2026-12-01

Mostrando 39 de 39 tipos (156 miembros)

EricksonLopez.RateLimiting#

17
class

ClientIpNormalizer

Ensamblado: EricksonLopez.RateLimiting
public static class ClientIpNormalizer

Provides canonical, allocation-conscious client IP normalization across HTTP sockets and gRPC peer strings.

Notas:

Strips transport ports and IPv6 zone indices, maps IPv4-mapped IPv6 addresses (`::ffff:x.x.x.x`) to canonical IPv4 dotted-quad form, and unifies IPv4/IPv6 loopback addresses to `127.0.0.1` so dual-stack transports cannot split rate-limit or lockout partitions.

Miembros (3)

  • methodNormalize
    public static string Normalize(IPAddress? address, string fallback = UnknownAddress)

    Normalizes a socket `IPAddress` into a canonical partition string.

    address: IPAddress?
    The remote client IP address, or `null` if unavailable
    fallback: string
    The fallback token returned when `address` is `null`

    Retorna: The canonicalized IPv4 or IPv6 address string, or `fallback`.

    Exceptions: ArgumentException: `fallback` is `null`, empty, or white-space

  • methodNormalize
    public static string Normalize(string? endpointOrPeer, string fallback = UnknownAddress)

    Normalizes a raw HTTP endpoint or gRPC peer string (such as `ipv4:203.0.113.5:54321` or `ipv6:[::ffff:203.0.113.5]:50051`) into a canonical IP string.

    endpointOrPeer: string?
    The raw IP, `ip:port`, `[ipv6]:port`, or gRPC peer string
    fallback: string
    The fallback token returned when `endpointOrPeer` is empty or invalid

    Retorna: The canonicalized IPv4 or IPv6 address string, or `fallback`.

    Exceptions: ArgumentException: `fallback` is `null`, empty, or white-space

  • fieldUnknownAddress
    public const string UnknownAddress

    Defines the default fallback identifier returned when a client IP address is missing or unparseable.

class

CompositeRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public sealed class CompositeRateLimiter : IRateLimiter, IRollbackableRateLimiter
Implementa: IRateLimiter, IRollbackableRateLimiter

Evaluates multiple child rate limiters in sequential order using conjunction logic.

Notas:

All child limiters must grant a lease for the overall acquisition to succeed. If any child limiter rejects or fails, previously acquired leases in the chain are rolled back. Allocation characteristics: Each `AcquireAsync` call allocates one fixed-size `RateLimitLease` array on the managed heap, sized to the number of child limiters. An additional delegate closure is allocated only when at least one child limiter carries a disposal action (e.g. `ConcurrencyRateLimiter`).

Miembros (4)

  • constructorCompositeRateLimiter
    public CompositeRateLimiter(IEnumerable<IRateLimiter> limiters)

    Initializes a new instance of the `CompositeRateLimiter` class with the specified child limiters.

    limiters: IEnumerable<IRateLimiter>
    The ordered sequence of child rate limiters to evaluate

    Exceptions: ArgumentNullException: `limiters` is `null`; ArgumentException: `limiters` contains no elements or contains a `null` element

  • constructorCompositeRateLimiter
    public CompositeRateLimiter(params IRateLimiter[] limiters)

    Initializes a new instance of the `CompositeRateLimiter` class with child limiters provided as an array.

    limiters: params IRateLimiter[]
    The array of child rate limiters to evaluate

    Exceptions: ArgumentNullException: `limiters` is `null`; ArgumentException: `limiters` contains no elements or contains a `null` element

  • methodAcquireAsync
    public async Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

  • propertyLimiters
    public IReadOnlyList<IRateLimiter> Limiters { get; }

    Gets the ordered collection of child rate limiters evaluated by this instance.

class

ConcurrencyRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public sealed class ConcurrencyRateLimiter : IRateLimiter
Implementa: IRateLimiter

Controls the number of concurrent in-flight operations permitted per partition key.

Notas:

Permit acquisition and release within each `ConcurrencyPartition` use lock-free atomic `Interlocked.CompareExchange(ref int, int, int)` operations, guaranteeing bounded latency under high concurrency without spin-wait queuing. Partition lookup via `Concurrent.ConcurrentDictionary<TKey, TValue>` uses its own internal locking for structural modifications. Idle partition pruning iterates the full partition set and is not lock-free. These operations occur off the hot-path (only when `ConcurrencyRateLimiterOptions.MaxPartitions` is reached). Disposing an acquired `RateLimitLease` releases allocated permits back to the partition atomically via a one-shot disposer, preventing double-release.

Miembros (2)

  • constructorConcurrencyRateLimiter
    public ConcurrencyRateLimiter(ConcurrencyRateLimiterOptions? options = null)

    Initializes a new instance of the `ConcurrencyRateLimiter` class using the specified options.

    options: ConcurrencyRateLimiterOptions?
    The configuration options for the rate limiter, or `null` to use default options
  • methodAcquireAsync
    public Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

class

ConcurrencyRateLimiterOptions

Ensamblado: EricksonLopez.RateLimiting
public sealed class ConcurrencyRateLimiterOptions

Specifies configuration options for `ConcurrencyRateLimiter`.

Miembros (2)

  • propertyMaxPartitions
    public int MaxPartitions { get; set; }

    Gets or sets the maximum number of partition keys retained concurrently before eviction of idle partitions.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyPermitLimit
    public int PermitLimit { get; set; }

    Gets or sets the maximum number of concurrent operations permitted.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

class

DefensiveLockoutOptions

Ensamblado: EricksonLopez.RateLimiting
public sealed class DefensiveLockoutOptions

Specifies configuration options for perimeter defensive lockout protection against brute-force and credential-stuffing sweeps.

Miembros (10)

  • propertyDeviceTokenHeaderName
    public string DeviceTokenHeaderName { get; set; }

    Gets or sets the optional device fingerprint HTTP header name evaluated independently alongside the client IP. Defaults to `"Device-Token"`.

    Exceptions: ArgumentException: `value` is `null`, empty, or white-space

  • propertyEnabled
    public bool Enabled { get; set; }

    Gets or sets a value indicating whether defensive lockout evaluation is enabled. Defaults to `true`.

  • propertyExcludedPathPrefixes
    public IList<string> ExcludedPathPrefixes { get; set; }

    Gets or sets the request path prefixes (such as Kubernetes health and readiness probes) excluded from lockout checks and tracking. Defaults to `["/health"]`.

    Exceptions: ArgumentNullException: `value` is `null`

  • propertyFailClosedOnStoreError
    public bool FailClosedOnStoreError { get; set; }

    Gets or sets a value indicating whether requests should be rejected with HTTP 503 when the backing lockout store fails. Defaults to `false`.

  • propertyFailureWindow
    public TimeSpan FailureWindow { get; set; }

    Gets or sets the sliding observation window for counting failed authentication attempts. Defaults to 5 minutes.

    Exceptions: ArgumentOutOfRangeException: `value` is less than or equal to `TimeSpan.Zero`

  • propertyLockoutDuration
    public TimeSpan LockoutDuration { get; set; }

    Gets or sets the duration for which a key remains locked out once `MaxFailedAttempts` is reached. Defaults to 15 minutes.

    Exceptions: ArgumentOutOfRangeException: `value` is less than or equal to `TimeSpan.Zero`

  • propertyMaxDeviceTokenLength
    public int MaxDeviceTokenLength { get; set; }

    Gets or sets the maximum raw character length accepted for the device token header before deterministic SHA-256 hashing is applied. Defaults to `256`.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyMaxFailedAttempts
    public int MaxFailedAttempts { get; set; }

    Gets or sets the maximum number of failed attempts permitted within `FailureWindow` before triggering a lockout. Defaults to `10`.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyMaxTrackedKeys
    public int MaxTrackedKeys { get; set; }

    Gets or sets the maximum number of unlocked failure-window keys retained in memory before unlocked entries are pruned. Active locked keys are never evicted. Defaults to `50,000`.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyMonitoredPathSegments
    public IList<string> MonitoredPathSegments { get; set; }

    Gets or sets the request path segments monitored for HTTP 401 Unauthorized responses. Defaults to `["/auth/"]`. When empty, all non-excluded paths returning 401 are tracked.

    Exceptions: ArgumentNullException: `value` is `null`

class

FixedWindowRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public sealed class FixedWindowRateLimiter : IRateLimiter, IRollbackableRateLimiter
Implementa: IRateLimiter, IRollbackableRateLimiter

Controls request rates using an in-memory discrete fixed time window algorithm.

Notas:

Partitions reset their accumulated permit count when each consecutive fixed time window elapses. This type is thread-safe.

Miembros (2)

  • constructorFixedWindowRateLimiter
    public FixedWindowRateLimiter(RateLimiterOptions? options = null, TimeProvider? timeProvider = null)

    Initializes a new instance of the `FixedWindowRateLimiter` class with the specified options and time provider.

    options: RateLimiterOptions?
    The configuration options for the rate limiter, or `null` to use default options
    timeProvider: TimeProvider?
    The time provider used for time-based window calculations, or `null` to use `TimeProvider.System`
  • methodAcquireAsync
    public Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

interface

IDefensiveLockoutStore

Ensamblado: EricksonLopez.RateLimiting
public interface IDefensiveLockoutStore

Defines a thread-safe persistence store for tracking failed authentication bursts and enforcing defensive lockouts across single or distributed application nodes.

Miembros (3)

  • methodCheckLockoutAsync
    Task<Result<LockoutStatus>> CheckLockoutAsync(string key, CancellationToken cancellationToken = default)

    Evaluates whether the specified partition key is currently subject to an active defensive lockout.

    key: string
    The normalized partition key (for example, `ip:203.0.113.10` or `dev:token`)
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the current `LockoutStatus` for `key`.

  • methodRecordFailureAsync
    Task<Result<LockoutStatus>> RecordFailureAsync(string key, CancellationToken cancellationToken = default)

    Atomically records a failed authentication attempt for the specified key and transitions it to a locked state if the configured threshold is reached.

    key: string
    The normalized partition key
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the updated `LockoutStatus` after recording the failure.

  • methodResetAsync
    Task<global::EricksonLopez.Result.Result> ResetAsync(string key, CancellationToken cancellationToken = default)

    Clears any recorded failure counters and active lockout state for the specified key.

    key: string
    The normalized partition key to reset
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result indicating whether the reset succeeded.

interface

IRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public interface IRateLimiter

Defines rate limiting capabilities for concurrency and throughput throttling.

Notas:

Implementations of this interface should be thread-safe.

Miembros (1)

  • methodAcquireAsync
    Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

class

InMemoryDefensiveLockoutStore

Ensamblado: EricksonLopez.RateLimiting
public sealed class InMemoryDefensiveLockoutStore : IDefensiveLockoutStore
Implementa: IDefensiveLockoutStore

Provides a thread-safe, bounded in-memory implementation of `IDefensiveLockoutStore` driven by `TimeProvider`.

Notas:

Protects against unauthenticated header/token flooding by pruning expired windows first and evicting only unlocked entries when `DefensiveLockoutOptions.MaxTrackedKeys` is reached. Active locked keys (`LockedUntil > now`) are never evicted prior to expiration.

Miembros (4)

  • constructorInMemoryDefensiveLockoutStore
    public InMemoryDefensiveLockoutStore(DefensiveLockoutOptions? options = null, TimeProvider? timeProvider = null)

    Initializes a new instance of the `InMemoryDefensiveLockoutStore` class.

    options: DefensiveLockoutOptions?
    The defensive lockout options, or `null` to use default options
    timeProvider: TimeProvider?
    The time provider used for window and lockout expiration, or `null` to use `TimeProvider.System`
  • methodCheckLockoutAsync
    public Task<Result<LockoutStatus>> CheckLockoutAsync(string key, CancellationToken cancellationToken = default)

    Evaluates whether the specified partition key is currently subject to an active defensive lockout.

    key: string
    The normalized partition key (for example, `ip:203.0.113.10` or `dev:token`)
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the current `LockoutStatus` for `key`.

  • methodRecordFailureAsync
    public Task<Result<LockoutStatus>> RecordFailureAsync(string key, CancellationToken cancellationToken = default)

    Atomically records a failed authentication attempt for the specified key and transitions it to a locked state if the configured threshold is reached.

    key: string
    The normalized partition key
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the updated `LockoutStatus` after recording the failure.

  • methodResetAsync
    public Task<global::EricksonLopez.Result.Result> ResetAsync(string key, CancellationToken cancellationToken = default)

    Clears any recorded failure counters and active lockout state for the specified key.

    key: string
    The normalized partition key to reset
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result indicating whether the reset succeeded.

record

LockoutStatus

Ensamblado: EricksonLopez.RateLimiting
public readonly record struct LockoutStatus(bool IsLockedOut, TimeSpan RetryAfter, long FailureCount)

Represents the current defensive lockout evaluation state for a tracked client or device key.

Miembros (6)

  • constructorLockoutStatus
    public LockoutStatus(bool IsLockedOut, TimeSpan RetryAfter, long FailureCount)

    Initializes a new instance of LockoutStatus.

    IsLockedOut: bool
    A value indicating whether the key is currently blocked by an active lockout lease
    RetryAfter: TimeSpan
    The remaining lockout duration before the key may retry, or `TimeSpan.Zero` when not locked out
    FailureCount: long
    The number of recorded authentication failures within the active observation window or lockout
  • methodAllowed
    public static LockoutStatus Allowed(long failureCount = 0)

    Creates a `LockoutStatus` representing a non-locked state.

    failureCount: long
    The number of recorded failures in the current window

    Retorna: An unlocked `LockoutStatus` instance.

  • methodLocked
    public static LockoutStatus Locked(TimeSpan retryAfter, long failureCount)

    Creates a `LockoutStatus` representing an active lockout state.

    retryAfter: TimeSpan
    The remaining duration until the lockout expires
    failureCount: long
    The total failure count associated with the lockout

    Retorna: A locked `LockoutStatus` instance.

  • propertyFailureCount
    public long FailureCount { get; init; }

    The number of recorded authentication failures within the active observation window or lockout

  • propertyIsLockedOut
    public bool IsLockedOut { get; init; }

    A value indicating whether the key is currently blocked by an active lockout lease

  • propertyRetryAfter
    public TimeSpan RetryAfter { get; init; }

    The remaining lockout duration before the key may retry, or `TimeSpan.Zero` when not locked out

record

RateLimitLease

Ensamblado: EricksonLopez.RateLimiting
public readonly record struct RateLimitLease(bool IsAcquired, int RemainingPermits, TimeSpan? RetryAfter, DateTimeOffset? ResetTime, Action? DisposeAction, int? Limit) : IDisposable
Implementa: IDisposable

Represents the result of an attempt to acquire permits from a rate limiter.

Miembros (17)

  • constructorRateLimitLease
    public RateLimitLease(bool isAcquired, int remainingPermits, TimeSpan? retryAfter, DateTimeOffset? resetTime)

    Initializes a new instance of the `RateLimitLease` struct without a disposal callback or limit quota.

    isAcquired: bool
    A value indicating whether the requested permits were successfully leased
    remainingPermits: int
    The number of permits remaining in the active window
    retryAfter: TimeSpan?
    The duration to wait before retrying when rejected
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
  • constructorRateLimitLease
    public RateLimitLease(bool isAcquired, int remainingPermits, TimeSpan? retryAfter, DateTimeOffset? resetTime, Action? disposeAction)

    Initializes a new instance of the `RateLimitLease` struct with a disposal callback.

    isAcquired: bool
    A value indicating whether the requested permits were successfully leased
    remainingPermits: int
    The number of permits remaining in the active window
    retryAfter: TimeSpan?
    The duration to wait before retrying when rejected
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    disposeAction: Action?
    The optional callback invoked when the lease is disposed
  • constructorRateLimitLease
    public RateLimitLease(bool IsAcquired, int RemainingPermits, TimeSpan? RetryAfter = null, DateTimeOffset? ResetTime = null, Action? DisposeAction = null, int? Limit = null)

    Initializes a new instance of RateLimitLease.

    IsAcquired: bool
    A value indicating whether the requested permits were successfully leased
    RemainingPermits: int
    The number of permits remaining in the active window
    RetryAfter: TimeSpan?
    The duration to wait before retrying when the lease is rejected
    ResetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    DisposeAction: Action?
    The optional callback invoked when the lease is disposed
    Limit: int?
    The total permit limit or quota configured for the rate limiter
  • methodDeconstruct
    public void Deconstruct(out bool isAcquired, out int remainingPermits, out TimeSpan? retryAfter, out DateTimeOffset? resetTime)

    Deconstructs the lease into its acquisition state, remaining permits, retry interval, and reset time.

    isAcquired: out bool
    When this method returns, contains a value indicating whether permits were acquired
    remainingPermits: out int
    When this method returns, contains the remaining permits
    retryAfter: out TimeSpan?
    When this method returns, contains the retry-after duration
    resetTime: out DateTimeOffset?
    When this method returns, contains the reset timestamp
  • methodDeconstruct
    public void Deconstruct(out bool isAcquired, out int remainingPermits, out TimeSpan? retryAfter, out DateTimeOffset? resetTime, out Action? disposeAction)

    Deconstructs the lease into its acquisition state, remaining permits, retry interval, reset time, and disposal callback.

    isAcquired: out bool
    When this method returns, contains a value indicating whether permits were acquired
    remainingPermits: out int
    When this method returns, contains the remaining permits
    retryAfter: out TimeSpan?
    When this method returns, contains the retry-after duration
    resetTime: out DateTimeOffset?
    When this method returns, contains the reset timestamp
    disposeAction: out Action?
    When this method returns, contains the disposal callback
  • methodDispose
    public void Dispose()

    Inherits documentation from base type or interface.

  • methodRejected
    public static RateLimitLease Rejected(TimeSpan retryAfter, DateTimeOffset? resetTime = null, int? limit = null)

    Creates a rejected lease with the specified retry duration, reset time, and permit quota.

    retryAfter: TimeSpan
    The duration to wait before retrying the request
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    limit: int?
    The total permit limit configured for the rate limiter policy

    Retorna: A new `RateLimitLease` representing a rejected lease.

  • methodSuccessful
    public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime = null)

    Creates a successful lease with the specified remaining permits and optional reset time.

    remainingPermits: int
    The number of permits remaining in the active window
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets

    Retorna: A new `RateLimitLease` representing a granted lease.

  • methodSuccessful
    public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, Action? disposeAction)

    Creates a successful lease with an optional disposal callback.

    remainingPermits: int
    The number of permits remaining in the active window
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    disposeAction: Action?
    The callback invoked when the lease is disposed

    Retorna: A new `RateLimitLease` representing a granted lease.

  • methodSuccessful
    public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, Action? disposeAction, int? limit)

    Creates a successful lease with an optional disposal callback and policy quota limit.

    remainingPermits: int
    The number of permits remaining in the active window
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    disposeAction: Action?
    The callback invoked when the lease is disposed
    limit: int?
    The total permit limit configured for the rate limiter policy

    Retorna: A new `RateLimitLease` representing a granted lease.

  • methodSuccessful
    public static RateLimitLease Successful(int remainingPermits, DateTimeOffset? resetTime, int? limit)

    Creates a successful lease with the specified remaining permits, reset time, and total permit quota.

    remainingPermits: int
    The number of permits remaining in the active window
    resetTime: DateTimeOffset?
    The absolute point in time when the rate limit counter resets
    limit: int?
    The total permit limit configured for the rate limiter policy

    Retorna: A new `RateLimitLease` representing a granted lease.

  • propertyDisposeAction
    public Action? DisposeAction { get; init; }

    The optional callback invoked when the lease is disposed

  • propertyIsAcquired
    public bool IsAcquired { get; init; }

    A value indicating whether the requested permits were successfully leased

  • propertyLimit
    public int? Limit { get; init; }

    The total permit limit or quota configured for the rate limiter

  • propertyRemainingPermits
    public int RemainingPermits { get; init; }

    The number of permits remaining in the active window

  • propertyResetTime
    public DateTimeOffset? ResetTime { get; init; }

    The absolute point in time when the rate limit counter resets

  • propertyRetryAfter
    public TimeSpan? RetryAfter { get; init; }

    The duration to wait before retrying when the lease is rejected

class

RateLimiterOptions

Ensamblado: EricksonLopez.RateLimiting
public sealed class RateLimiterOptions

Specifies configuration options for time-windowed rate limiters.

Miembros (4)

  • propertyMaxPartitions
    public int MaxPartitions { get; set; }

    Gets or sets the maximum number of partition keys retained concurrently before eviction of idle partitions.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyPermitLimit
    public int PermitLimit { get; set; }

    Gets or sets the maximum number of permitted requests allowed within each time window.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertySegmentsPerWindow
    public int SegmentsPerWindow { get; set; }

    Gets or sets the number of discrete segments into which each sliding window is divided.

    This property is used exclusively by `SlidingWindowRateLimiter` to smooth burst traffic across segment boundaries. It is ignored by `FixedWindowRateLimiter` and `TokenBucketRateLimiter`. Exceptions: ArgumentOutOfRangeException: `value` is less than 1 or greater than 10,000

  • propertyWindow
    public TimeSpan Window { get; set; }

    Gets or sets the duration of the rate limiting time window.

    Exceptions: ArgumentOutOfRangeException: `value` is less than or equal to `TimeSpan.Zero`

class

RateLimitingErrorCodes

Ensamblado: EricksonLopez.RateLimiting
public static class RateLimitingErrorCodes

Provides standardized error code constants for rate limiting failure conditions.

Notas:

Use these constants in error callbacks to perform programmatic pattern matching without relying on magic strings. Example:

options.OnRedisFailure = async (context, error, ct) =>
{
    if (error.Code == RateLimitingErrorCodes.ConnectionFailedCode)
    {
        // Handle Redis connection failure specifically
        context.Response.Headers["X-RateLimit-Degraded"] = "true";
    }
    await Task.CompletedTask;
};

Miembros (1)

  • fieldConnectionFailedCode
    public const string ConnectionFailedCode

    Defines the error code emitted when a distributed cache operation fails due to a connection error, timeout, or network partition.

class

RateLimitingMetrics

Ensamblado: EricksonLopez.RateLimiting
public static class RateLimitingMetrics

Provides OpenTelemetry-compatible metrics instrumentation for the rate limiting ecosystem.

Miembros (5)

  • methodRecordRequest
    public static void RecordRequest(string limiterType, string status, double durationMs)

    Records a rate limiter permit evaluation attempt and its duration.

    limiterType: string
    The algorithm or classification of the rate limiter
    status: string
    The outcome status of the evaluation, such as acquired, rejected, or failed
    durationMs: double
    The elapsed duration of the acquisition attempt in milliseconds
  • fieldLeaseDuration
    public static readonly Histogram<double> LeaseDuration

    Encapsulates the histogram tracking latency of rate limit permit acquisition attempts in milliseconds.

  • fieldMeterName
    public const string MeterName

    Specifies the name of the meter instrumenting rate limiting operations.

  • fieldMeterVersion
    public const string MeterVersion

    Specifies the version string of the meter, synchronized with the package version.

  • fieldRequestsTotal
    public static readonly Counter<long> RequestsTotal

    Encapsulates the counter tracking total rate limit evaluation attempts.

class

RateLimitingServiceCollectionExtensions

Ensamblado: EricksonLopez.RateLimiting
public static class RateLimitingServiceCollectionExtensions

Provides extension methods for registering rate limiter services in an `IServiceCollection`.

Miembros (6)

  • methodAddCompositeRateLimiter
    public static IServiceCollection AddCompositeRateLimiter(this IServiceCollection services, params IRateLimiter[] limiters)

    Registers the `CompositeRateLimiter` as the default `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    limiters: params IRateLimiter[]
    The ordered sequence of child rate limiters to evaluate

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `limiters` is `null`

  • methodAddConcurrencyRateLimiter
    public static IServiceCollection AddConcurrencyRateLimiter(this IServiceCollection services, Action<ConcurrencyRateLimiterOptions>? configure = null)

    Registers the `ConcurrencyRateLimiter` as the default `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<ConcurrencyRateLimiterOptions>?
    The optional delegate used to configure `ConcurrencyRateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddFixedWindowRateLimiter
    public static IServiceCollection AddFixedWindowRateLimiter(this IServiceCollection services, Action<RateLimiterOptions>? configure = null)

    Registers the `FixedWindowRateLimiter` as the default `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RateLimiterOptions>?
    The optional delegate used to configure `RateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddInMemoryDefensiveLockout
    public static IServiceCollection AddInMemoryDefensiveLockout(this IServiceCollection services, Action<DefensiveLockoutOptions>? configure = null)

    Registers `InMemoryDefensiveLockoutStore` as the `IDefensiveLockoutStore` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<DefensiveLockoutOptions>?
    The optional delegate used to configure `DefensiveLockoutOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddSlidingWindowRateLimiter
    public static IServiceCollection AddSlidingWindowRateLimiter(this IServiceCollection services, Action<RateLimiterOptions>? configure = null)

    Registers the `SlidingWindowRateLimiter` as the default `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RateLimiterOptions>?
    The optional delegate used to configure `RateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddTokenBucketRateLimiter
    public static IServiceCollection AddTokenBucketRateLimiter(this IServiceCollection services, Action<RateLimiterOptions>? configure = null)

    Registers the `TokenBucketRateLimiter` as the default `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RateLimiterOptions>?
    The optional delegate used to configure `RateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

class

SlidingWindowRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public sealed class SlidingWindowRateLimiter : IRateLimiter, IRollbackableRateLimiter
Implementa: IRateLimiter, IRollbackableRateLimiter

Controls request rates using an in-memory segmented sliding time window algorithm.

Notas:

Dividing the time window into segments provides smooth boundary transitions and avoids boundary burst anomalies. This type is thread-safe.

Miembros (2)

  • constructorSlidingWindowRateLimiter
    public SlidingWindowRateLimiter(RateLimiterOptions? options = null, TimeProvider? timeProvider = null)

    Initializes a new instance of the `SlidingWindowRateLimiter` class with the specified options and time provider.

    options: RateLimiterOptions?
    The configuration options for the rate limiter, or `null` to use default options
    timeProvider: TimeProvider?
    The time provider used for segment calculations, or `null` to use `TimeProvider.System`
  • methodAcquireAsync
    public Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

class

TokenBucketRateLimiter

Ensamblado: EricksonLopez.RateLimiting
public sealed class TokenBucketRateLimiter : IRateLimiter, IRollbackableRateLimiter
Implementa: IRateLimiter, IRollbackableRateLimiter

Controls request rates using an in-memory continuous token bucket replenishment algorithm.

Notas:

Permits refill continuously over time based on the configured rate limit capacity and window duration. This type is thread-safe.

Miembros (2)

  • constructorTokenBucketRateLimiter
    public TokenBucketRateLimiter(RateLimiterOptions? options = null, TimeProvider? timeProvider = null)

    Initializes a new instance of the `TokenBucketRateLimiter` class with the specified options and time provider.

    options: RateLimiterOptions?
    The configuration options for the rate limiter, or `null` to use default options
    timeProvider: TimeProvider?
    The time provider used for replenishment calculations, or `null` to use `TimeProvider.System`
  • methodAcquireAsync
    public Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

EricksonLopez.RateLimiting.AspNetCore#

10
class

DefensiveLockoutMiddleware

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public sealed class DefensiveLockoutMiddleware

Enforces distributed or in-memory defensive lockouts against credential-stuffing and brute-force sweeps.

Notas:

Evaluates normalized Client IP and optional device token headers as independent lockout perimeters so rotating or spoofing `Device-Token` headers can never bypass an active IP lockout, while excluding configured probe prefixes such as `/health`, `/health/live`, and `/health/ready`.

Miembros (2)

  • constructorDefensiveLockoutMiddleware
    public DefensiveLockoutMiddleware(RequestDelegate next, ILogger<DefensiveLockoutMiddleware> logger, IOptions<DefensiveLockoutOptions>? options = null)

    Initializes a new instance of the `DefensiveLockoutMiddleware` class.

    next: RequestDelegate
    The next request delegate in the HTTP pipeline
    logger: ILogger<DefensiveLockoutMiddleware>
    The operational logger
    options: IOptions<DefensiveLockoutOptions>?
    The optional defensive lockout options accessor

    Exceptions: ArgumentNullException: `next` or `logger` is `null`

  • methodInvokeAsync
    public async Task InvokeAsync(HttpContext context, IDefensiveLockoutStore? lockoutStore = null)

    Evaluates incoming HTTP requests against active IP and device lockouts and records failed authentication responses.

    context: HttpContext
    The current HTTP context
    lockoutStore: IDefensiveLockoutStore?
    The optional defensive lockout store resolved from dependency injection

    Retorna: A task representing the asynchronous middleware execution.

    Exceptions: ArgumentNullException: `context` is `null`

class

DisableRateLimitingAttribute

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public sealed class DisableRateLimitingAttribute : Attribute, IDisableRateLimitingMetadata
Hereda de: AttributeImplementa: IDisableRateLimitingMetadata

Disables rate limiting on the target endpoint or action, overriding any parent or default policies.

Miembros (0)

Este tipo declara 0 miembros públicos (por ejemplo, interfaz marcadora o enum/record vacío).

class

EnableRateLimitingAttribute

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public sealed class EnableRateLimitingAttribute : Attribute, IEnableRateLimitingMetadata
Hereda de: AttributeImplementa: IEnableRateLimitingMetadata

Specifies that rate limiting should be enabled on the target endpoint or controller using the given policy name.

Miembros (2)

  • constructorEnableRateLimitingAttribute
    public EnableRateLimitingAttribute(string policyName)

    Initializes a new instance of the `EnableRateLimitingAttribute` class with the specified policy name.

    policyName: string
    The unique identifier of the rate limiting policy to apply

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters

  • propertyPolicyName
    public string PolicyName { get; }

    Gets the unique identifier of the rate limiting policy to apply to the endpoint.

class

EndpointRateLimitingExtensions

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public static class EndpointRateLimitingExtensions

Provides extension methods for adding rate limiting metadata to ASP.NET Core endpoint routing conventions.

Miembros (4)

  • methodDisableDistributedRateLimiting<TBuilder>
    public static TBuilder DisableDistributedRateLimiting<TBuilder>(this TBuilder builder) where TBuilder : IEndpointConventionBuilder

    Disables rate limiting for the endpoint.

    builder: this TBuilder
    The endpoint convention builder

    Retorna: The endpoint convention builder instance to enable method chaining.

    This method provides backward compatibility and functions identically to `DisableRateLimiting<TBuilder>`. Type parameters: TBuilder: The endpoint convention builder type Exceptions: ArgumentNullException: `builder` is `null`

  • methodDisableRateLimiting<TBuilder>
    public static TBuilder DisableRateLimiting<TBuilder>(this TBuilder builder) where TBuilder : IEndpointConventionBuilder

    Disables rate limiting for the endpoint.

    builder: this TBuilder
    The endpoint convention builder

    Retorna: The endpoint convention builder instance to enable method chaining.

    Type parameters: TBuilder: The endpoint convention builder type Exceptions: ArgumentNullException: `builder` is `null`

  • methodRequireDistributedRateLimiting<TBuilder>
    public static TBuilder RequireDistributedRateLimiting<TBuilder>(this TBuilder builder, string policyName) where TBuilder : IEndpointConventionBuilder

    Applies a named rate limiting policy to the endpoint.

    builder: this TBuilder
    The endpoint convention builder
    policyName: string
    The unique identifier of the rate limiting policy to apply

    Retorna: The endpoint convention builder instance to enable method chaining.

    This method provides backward compatibility and functions identically to `RequireRateLimiting<TBuilder>`. Type parameters: TBuilder: The endpoint convention builder type Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters

  • methodRequireRateLimiting<TBuilder>
    public static TBuilder RequireRateLimiting<TBuilder>(this TBuilder builder, string policyName) where TBuilder : IEndpointConventionBuilder

    Applies a named rate limiting policy to the endpoint.

    builder: this TBuilder
    The endpoint convention builder
    policyName: string
    The unique identifier of the rate limiting policy to apply

    Retorna: The endpoint convention builder instance to enable method chaining.

    Type parameters: TBuilder: The endpoint convention builder type Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters

interface

IDisableRateLimitingMetadata

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public interface IDisableRateLimitingMetadata

Defines a marker contract for endpoint metadata that disables rate limiting.

Miembros (0)

Este tipo declara 0 miembros públicos (por ejemplo, interfaz marcadora o enum/record vacío).

interface

IEnableRateLimitingMetadata

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public interface IEnableRateLimitingMetadata

Defines a contract for endpoint metadata that associates a named rate limiting policy.

Miembros (1)

  • propertyPolicyName
    string PolicyName { get; }

    Gets the unique identifier of the rate limiting policy to apply to the endpoint.

class

RateLimitingAspNetCoreExtensions

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public static class RateLimitingAspNetCoreExtensions

Provides extension methods for registering and applying rate limiting middleware in ASP.NET Core.

Miembros (5)

  • methodAddDefensiveLockout
    public static IServiceCollection AddDefensiveLockout(this IServiceCollection services, Action<DefensiveLockoutOptions>? configure = null)

    Registers defensive lockout options and a default `InMemoryDefensiveLockoutStore` (if no distributed `IDefensiveLockoutStore` is registered).

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<DefensiveLockoutOptions>?
    The optional delegate used to configure `DefensiveLockoutOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddHttpRateLimiting
    public static IServiceCollection AddHttpRateLimiting(this IServiceCollection services, Action<RateLimitingMiddlewareOptions>? configure = null)

    Configures HTTP rate limiting options in Microsoft Dependency Injection.

    services: this IServiceCollection
    The service collection to register options into
    configure: Action<RateLimitingMiddlewareOptions>?
    The optional delegate used to configure `RateLimitingMiddlewareOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddRateLimiting
    public static IServiceCollection AddRateLimiting(this IServiceCollection services, Action<RateLimiterPolicyBuilder> configure, Action<RateLimitingMiddlewareOptions>? configureMiddleware = null)

    Registers named rate limiting policies using a fluent builder and configures middleware services.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RateLimiterPolicyBuilder>
    The delegate used to configure named rate limiting policies
    configureMiddleware: Action<RateLimitingMiddlewareOptions>?
    The optional delegate used to configure middleware options

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `configure` is `null`

  • methodUseDefensiveLockout
    public static IApplicationBuilder UseDefensiveLockout(this IApplicationBuilder app)

    Adds `DefensiveLockoutMiddleware` into the application request execution pipeline.

    app: this IApplicationBuilder
    The application pipeline builder

    Retorna: The application builder instance to enable method chaining.

    Exceptions: ArgumentNullException: `app` is `null`

  • methodUseHttpRateLimiting
    public static IApplicationBuilder UseHttpRateLimiting(this IApplicationBuilder app)

    Adds `RateLimitingMiddleware` into the application request execution pipeline.

    app: this IApplicationBuilder
    The application pipeline builder

    Retorna: The application builder instance to enable method chaining.

    Exceptions: ArgumentNullException: `app` is `null`

class

RateLimitingHeaders

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public static class RateLimitingHeaders

Defines standard HTTP header constants used in rate limiting responses.

Miembros (4)

  • fieldLimit
    public const string Limit

    Specifies the header name for the maximum number of requests permitted in the current time window.

  • fieldRemaining
    public const string Remaining

    Specifies the header name for the number of requests remaining in the current time window.

  • fieldReset
    public const string Reset

    Specifies the header name for the UNIX timestamp when the current rate limit window resets.

  • fieldRetryAfter
    public const string RetryAfter

    Specifies the standard HTTP header name for the retry interval after a rejected request.

class

RateLimitingMiddleware

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public sealed class RateLimitingMiddleware

Enforces HTTP rate limits on incoming requests and injects standard rate limit headers into responses.

Miembros (2)

  • constructorRateLimitingMiddleware
    public RateLimitingMiddleware(RequestDelegate next, IOptions<RateLimitingMiddlewareOptions> options)

    Initializes a new instance of the `RateLimitingMiddleware` class.

    next: RequestDelegate
    The next request processing delegate in the HTTP pipeline
    options: IOptions<RateLimitingMiddlewareOptions>
    The configuration options accessor for rate limiting behavior

    Exceptions: ArgumentNullException: `next` or `options` is `null`

  • methodInvokeAsync
    public async Task InvokeAsync(HttpContext context, IRateLimiter? rateLimiter = null, IRateLimiterPolicyRegistry? policyRegistry = null)

    Processes an incoming HTTP request, enforcing rate limits and attaching response headers.

    context: HttpContext
    The HTTP context for the current request
    rateLimiter: IRateLimiter?
    The optional rate limiter instance resolved from dependency injection
    policyRegistry: IRateLimiterPolicyRegistry?
    The optional rate limiter policy registry resolved from dependency injection

    Retorna: A task representing the asynchronous middleware execution.

    Exceptions: ArgumentNullException: `context` is `null`; InvalidOperationException: The specified endpoint rate limiting policy is not registered

class

RateLimitingMiddlewareOptions

Ensamblado: EricksonLopez.RateLimiting.AspNetCore
public sealed class RateLimitingMiddlewareOptions

Specifies configuration options for the ASP.NET Core rate limiting middleware.

Miembros (9)

  • methodResolveDefaultPartitionKey
    public string ResolveDefaultPartitionKey(HttpContext context)

    Resolves a partition key prioritizing authenticated tenant/user claims and falling back to normalized client IP.

    context: HttpContext
    The HTTP context to inspect

    Retorna: The resolved partition key string.

    Exceptions: ArgumentNullException: `context` is `null`

  • propertyExcludedPathPrefixes
    public IList<string> ExcludedPathPrefixes { get; set; }

    Gets or sets the request path prefixes (such as Kubernetes health and readiness probes) excluded from rate limiting. Defaults to `["/health"]`.

    Exceptions: ArgumentNullException: `value` is `null`

  • propertyFailClosed
    public bool FailClosed { get; set; }

    Gets or sets a value indicating whether requests should be rejected with a 503 Service Unavailable status when the rate limiter fails.

  • propertyOnRedisFailure
    public Func<HttpContext, Error, CancellationToken, Task>? OnRedisFailure { get; set; }

    Gets or sets an optional callback invoked when rate limit evaluation fails due to an infrastructure error.

    When this callback is defined and a Redis infrastructure failure occurs, the middleware invokes the callback and then returns immediately — the downstream pipeline (`_next`) is NOT called. The callback is therefore responsible for completing the HTTP response (e.g., writing a body or setting headers), unless Fail-Open behavior is desired. To allow the request to proceed after logging/alerting, do not define this callback and rely on `FailClosed` instead: - `FailClosed = false` (default): Request proceeds to `_next` after Redis failure. - `FailClosed = true`: Request is rejected with HTTP `503 Service Unavailable`. - When `OnRedisFailure` is set: Callback runs, middleware returns — `_next` is never called regardless of `FailClosed`. Use `RateLimitingErrorCodes.ConnectionFailedCode` to programmatically match the error code without relying on a magic string.

  • propertyOnRejected
    public Func<HttpContext, RateLimitLease, CancellationToken, Task>? OnRejected { get; set; }

    Gets or sets an optional callback invoked when a request is rejected due to rate limiting.

  • propertyPartitionKeyResolver
    public Func<HttpContext, string> PartitionKeyResolver { get; set; }

    Gets or sets the delegate used to resolve the partition key from an incoming HTTP request.

    Defaults to post-`UseAuthentication()` tenant/user claim partitioning (`tenant:{tid}:user:{uid}`) when `HttpContext.User` is authenticated, falling back to canonicalized socket client IP via `ClientIpNormalizer` (or `"anonymous"` when no socket address is present). Exceptions: ArgumentNullException: `value` is `null`

  • propertyPermitCost
    public int PermitCost { get; set; }

    Gets or sets the permit cost evaluated per HTTP request.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyTenantClaimTypes
    public IList<string> TenantClaimTypes { get; set; }

    Gets or sets the ordered claim types inspected on authenticated principals to extract the tenant partition identifier.

    Exceptions: ArgumentNullException: `value` is `null`

  • propertyUserClaimTypes
    public IList<string> UserClaimTypes { get; set; }

    Gets or sets the ordered claim types inspected on authenticated principals to extract the user partition identifier.

    Exceptions: ArgumentNullException: `value` is `null`

EricksonLopez.RateLimiting.Policies#

5
interface

IRateLimiterPolicy

Ensamblado: EricksonLopez.RateLimiting
public interface IRateLimiterPolicy

Defines a named rate limiting policy bound to a rate limiter instance.

Miembros (2)

  • propertyLimiter
    IRateLimiter Limiter { get; }

    Gets the rate limiter instance associated with the policy.

  • propertyName
    string Name { get; }

    Gets the unique identifier of the policy.

interface

IRateLimiterPolicyRegistry

Ensamblado: EricksonLopez.RateLimiting
public interface IRateLimiterPolicyRegistry

Defines a registry for managing and resolving named rate limiting policies.

Miembros (3)

  • methodGetPolicy
    IRateLimiter? GetPolicy(string name)

    Retrieves a rate limiter for the specified policy name.

    name: string
    The unique identifier of the policy to retrieve

    Retorna: The `IRateLimiter` associated with the policy name, or `null` if not registered.

    Exceptions: ArgumentException: `name` is `null`, empty, or consists only of white-space characters

  • methodRegister
    void Register(string name, IRateLimiter limiter)

    Registers a named policy with its rate limiter instance.

    name: string
    The unique identifier of the policy
    limiter: IRateLimiter
    The rate limiter instance to associate with the policy name

    Exceptions: ArgumentException: `name` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `limiter` is `null`

  • propertyDefaultLimiter
    IRateLimiter? DefaultLimiter { get; set; }

    Gets or sets the default fallback rate limiter used when no policy is explicitly assigned.

class

RateLimiterPolicy

Ensamblado: EricksonLopez.RateLimiting
public sealed class RateLimiterPolicy : IRateLimiterPolicy
Implementa: IRateLimiterPolicy

Represents a named rate limiting policy.

Miembros (3)

  • constructorRateLimiterPolicy
    public RateLimiterPolicy(string name, IRateLimiter limiter)

    Initializes a new instance of the `RateLimiterPolicy` class with the specified name and rate limiter.

    name: string
    The unique identifier of the policy
    limiter: IRateLimiter
    The rate limiter implementation associated with the policy

    Exceptions: ArgumentException: `name` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `limiter` is `null`

  • propertyLimiter
    public IRateLimiter Limiter { get; }

    Gets the rate limiter instance associated with the policy.

  • propertyName
    public string Name { get; }

    Gets the unique identifier of the policy.

class

RateLimiterPolicyBuilder

Ensamblado: EricksonLopez.RateLimiting
public sealed class RateLimiterPolicyBuilder

Provides a fluent builder for configuring and registering named rate limiting policies.

Miembros (9)

  • methodAddComposite
    public RateLimiterPolicyBuilder AddComposite(string policyName, params IRateLimiter[] limiters)

    Configures and registers a composite rate limiting policy evaluated with conjunction logic.

    policyName: string
    The unique identifier of the policy
    limiters: params IRateLimiter[]
    The ordered sequence of child rate limiters

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `limiters` is `null`

  • methodAddConcurrency
    public RateLimiterPolicyBuilder AddConcurrency(string policyName, Action<ConcurrencyRateLimiterOptions> configure)

    Configures and registers a concurrency rate limiting policy.

    policyName: string
    The unique identifier of the policy
    configure: Action<ConcurrencyRateLimiterOptions>
    The delegate used to configure concurrency rate limiter options

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `configure` is `null`

  • methodAddFixedWindow
    public RateLimiterPolicyBuilder AddFixedWindow(string policyName, Action<RateLimiterOptions> configure, TimeProvider? timeProvider = null)

    Configures and registers a fixed window rate limiting policy.

    policyName: string
    The unique identifier of the policy
    configure: Action<RateLimiterOptions>
    The delegate used to configure rate limiter options
    timeProvider: TimeProvider?
    The optional time provider used for window calculations

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `configure` is `null`

  • methodAddPolicy
    public RateLimiterPolicyBuilder AddPolicy(string policyName, IRateLimiter limiter)

    Registers an arbitrary pre-instantiated rate limiter under the specified policy name.

    policyName: string
    The unique identifier of the policy
    limiter: IRateLimiter
    The rate limiter instance to associate with the policy

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `limiter` is `null`

  • methodAddSlidingWindow
    public RateLimiterPolicyBuilder AddSlidingWindow(string policyName, Action<RateLimiterOptions> configure, TimeProvider? timeProvider = null)

    Configures and registers a sliding window rate limiting policy.

    policyName: string
    The unique identifier of the policy
    configure: Action<RateLimiterOptions>
    The delegate used to configure rate limiter options
    timeProvider: TimeProvider?
    The optional time provider used for window calculations

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `configure` is `null`

  • methodAddTokenBucket
    public RateLimiterPolicyBuilder AddTokenBucket(string policyName, Action<RateLimiterOptions> configure, TimeProvider? timeProvider = null)

    Configures and registers a token bucket rate limiting policy.

    policyName: string
    The unique identifier of the policy
    configure: Action<RateLimiterOptions>
    The delegate used to configure rate limiter options
    timeProvider: TimeProvider?
    The optional time provider used for replenishment calculations

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `configure` is `null`

  • methodBuild
    public IRateLimiterPolicyRegistry Build()

    Builds and returns the configured policy registry.

    Retorna: The populated `IRateLimiterPolicyRegistry` containing all registered policies.

  • methodSetDefaultPolicy
    public RateLimiterPolicyBuilder SetDefaultPolicy(IRateLimiter limiter)

    Sets an explicit rate limiter instance as the default fallback policy.

    limiter: IRateLimiter
    The default rate limiter instance

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentNullException: `limiter` is `null`

  • methodSetDefaultPolicy
    public RateLimiterPolicyBuilder SetDefaultPolicy(string policyName)

    Sets an existing named policy as the default fallback policy.

    policyName: string
    The unique identifier of the registered policy

    Retorna: This builder instance to enable method chaining.

    Exceptions: ArgumentException: `policyName` is `null`, empty, or consists only of white-space characters; InvalidOperationException: The specified policy name is not registered

class

RateLimiterPolicyRegistry

Ensamblado: EricksonLopez.RateLimiting
public sealed class RateLimiterPolicyRegistry : IRateLimiterPolicyRegistry
Implementa: IRateLimiterPolicyRegistry

Provides a thread-safe registry for storing and resolving named rate limiting policies.

Miembros (3)

  • methodGetPolicy
    public IRateLimiter? GetPolicy(string name)

    Retrieves a rate limiter for the specified policy name.

    name: string
    The unique identifier of the policy to retrieve

    Retorna: The `IRateLimiter` associated with the policy name, or `null` if not registered.

    Exceptions: ArgumentException: `name` is `null`, empty, or consists only of white-space characters

  • methodRegister
    public void Register(string name, IRateLimiter limiter)

    Registers a named policy with its rate limiter instance.

    name: string
    The unique identifier of the policy
    limiter: IRateLimiter
    The rate limiter instance to associate with the policy name

    Exceptions: ArgumentException: `name` is `null`, empty, or consists only of white-space characters; ArgumentNullException: `limiter` is `null`

  • propertyDefaultLimiter
    public IRateLimiter? DefaultLimiter { get; set; }

    Gets or sets the default fallback rate limiter used when no policy is explicitly assigned.

EricksonLopez.RateLimiting.Redis#

7
class

RateLimitingRedisServiceCollectionExtensions

Ensamblado: EricksonLopez.RateLimiting.Redis
public static class RateLimitingRedisServiceCollectionExtensions

Provides extension methods for registering Redis-backed distributed rate limiters in an `IServiceCollection`.

Miembros (6)

  • methodAddRedisDefensiveLockout
    public static IServiceCollection AddRedisDefensiveLockout(this IServiceCollection services, Action<RedisDefensiveLockoutOptions> configureRedis, Action<DefensiveLockoutOptions>? configureLockout = null)

    Adds the Redis-backed distributed defensive lockout store as the `IDefensiveLockoutStore` service.

    services: this IServiceCollection
    The service collection to register services into
    configureRedis: Action<RedisDefensiveLockoutOptions>
    The delegate used to configure `RedisDefensiveLockoutOptions`
    configureLockout: Action<DefensiveLockoutOptions>?
    The optional delegate used to configure `DefensiveLockoutOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `configureRedis` is `null`

  • methodAddRedisDefensiveLockout
    public static IServiceCollection AddRedisDefensiveLockout(this IServiceCollection services, IConnectionMultiplexer connectionMultiplexer, Action<DefensiveLockoutOptions>? configureLockout = null, Action<RedisDefensiveLockoutOptions>? configureRedis = null)

    Adds the Redis-backed distributed defensive lockout store using an existing `IConnectionMultiplexer`.

    services: this IServiceCollection
    The service collection to register services into
    connectionMultiplexer: IConnectionMultiplexer
    The existing Redis connection multiplexer instance
    configureLockout: Action<DefensiveLockoutOptions>?
    The optional delegate used to configure `DefensiveLockoutOptions`
    configureRedis: Action<RedisDefensiveLockoutOptions>?
    The optional delegate used to configure `RedisDefensiveLockoutOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `connectionMultiplexer` is `null`

  • methodAddRedisRateLimiting
    public static IServiceCollection AddRedisRateLimiting(this IServiceCollection services, Action<RedisRateLimiterOptions> configure)

    Adds the Redis-backed sliding window rate limiter as the `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RedisRateLimiterOptions>
    The delegate used to configure `RedisRateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `configure` is `null`

  • methodAddRedisRateLimiting
    public static IServiceCollection AddRedisRateLimiting(this IServiceCollection services, IConnectionMultiplexer connectionMultiplexer, Action<RedisRateLimiterOptions>? configure = null)

    Adds the Redis-backed sliding window rate limiter using an existing `IConnectionMultiplexer`.

    services: this IServiceCollection
    The service collection to register services into
    connectionMultiplexer: IConnectionMultiplexer
    The existing Redis connection multiplexer instance
    configure: Action<RedisRateLimiterOptions>?
    The optional delegate used to configure `RedisRateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `connectionMultiplexer` is `null`

  • methodAddRedisTokenBucketRateLimiting
    public static IServiceCollection AddRedisTokenBucketRateLimiting(this IServiceCollection services, Action<RedisTokenBucketRateLimiterOptions> configure)

    Adds the Redis-backed token bucket rate limiter as the `IRateLimiter` service.

    services: this IServiceCollection
    The service collection to register services into
    configure: Action<RedisTokenBucketRateLimiterOptions>
    The delegate used to configure `RedisTokenBucketRateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `configure` is `null`

  • methodAddRedisTokenBucketRateLimiting
    public static IServiceCollection AddRedisTokenBucketRateLimiting(this IServiceCollection services, IConnectionMultiplexer connectionMultiplexer, Action<RedisTokenBucketRateLimiterOptions>? configure = null)

    Adds the Redis-backed token bucket rate limiter using an existing `IConnectionMultiplexer`.

    services: this IServiceCollection
    The service collection to register services into
    connectionMultiplexer: IConnectionMultiplexer
    The existing Redis connection multiplexer instance
    configure: Action<RedisTokenBucketRateLimiterOptions>?
    The optional delegate used to configure `RedisTokenBucketRateLimiterOptions`

    Retorna: The same service collection instance so that multiple calls can be chained.

    Exceptions: ArgumentNullException: `services` or `connectionMultiplexer` is `null`

class

RedisDefensiveLockoutOptions

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisDefensiveLockoutOptions

Specifies Redis connection and key-namespace options for `RedisDefensiveLockoutStore`.

Miembros (3)

  • propertyConfiguration
    public string Configuration { get; set; }

    Gets or sets the connection configuration string used by StackExchange.Redis.

    Exceptions: ArgumentException: `value` is `null`, empty, or white-space

  • propertyDatabase
    public int Database { get; set; }

    Gets or sets the target Redis database index (0 to 15).

    Exceptions: ArgumentOutOfRangeException: `value` is less than 0 or greater than 15

  • propertyKeyPrefix
    public string KeyPrefix { get; set; }

    Gets or sets the Redis key prefix applied to defensive lockout keys. Defaults to `"rl:lockout:"`.

    Exceptions: ArgumentNullException: `value` is `null`

class

RedisDefensiveLockoutStore

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisDefensiveLockoutStore : IDefensiveLockoutStore, IAsyncDisposable
Implementa: IAsyncDisposable, IDefensiveLockoutStore

Provides a distributed, Redis-backed implementation of `IDefensiveLockoutStore` using atomic Lua scripts and bounded `PEXPIRE` TTLs.

Notas:

Tracks failed authentication bursts in a sliding Redis sorted-set window (`:failures`) and enforces active lockouts via a dedicated Redis hash key (`:locked`), colocated on the same Redis Cluster hash slot via hash tags and immune to arbitrary cache-layer eviction.

Miembros (5)

  • constructorRedisDefensiveLockoutStore
    public RedisDefensiveLockoutStore(IConnectionMultiplexer connection, IOptions<DefensiveLockoutOptions> lockoutOptions, IOptions<RedisDefensiveLockoutOptions> redisOptions, ILogger<RedisDefensiveLockoutStore> logger, TimeProvider? timeProvider = null)

    Initializes a new instance of the `RedisDefensiveLockoutStore` class.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer
    lockoutOptions: IOptions<DefensiveLockoutOptions>
    The defensive lockout policy options accessor
    redisOptions: IOptions<RedisDefensiveLockoutOptions>
    The Redis lockout store options accessor
    logger: ILogger<RedisDefensiveLockoutStore>
    The operational logger
    timeProvider: TimeProvider?
    The optional time provider, or `null` to use `TimeProvider.System`

    Exceptions: ArgumentNullException: `connection`, `lockoutOptions`, `redisOptions`, or `logger` is `null`

  • methodCheckLockoutAsync
    public async Task<Result<LockoutStatus>> CheckLockoutAsync(string key, CancellationToken cancellationToken = default)

    Evaluates whether the specified partition key is currently subject to an active defensive lockout.

    key: string
    The normalized partition key (for example, `ip:203.0.113.10` or `dev:token`)
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the current `LockoutStatus` for `key`.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

  • methodRecordFailureAsync
    public async Task<Result<LockoutStatus>> RecordFailureAsync(string key, CancellationToken cancellationToken = default)

    Atomically records a failed authentication attempt for the specified key and transitions it to a locked state if the configured threshold is reached.

    key: string
    The normalized partition key
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result containing the updated `LockoutStatus` after recording the failure.

  • methodResetAsync
    public async Task<global::EricksonLopez.Result.Result> ResetAsync(string key, CancellationToken cancellationToken = default)

    Clears any recorded failure counters and active lockout state for the specified key.

    key: string
    The normalized partition key to reset
    cancellationToken: CancellationToken
    A token used to cancel the asynchronous store operation

    Retorna: A result indicating whether the reset succeeded.

class

RedisRateLimiterOptions

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisRateLimiterOptions

Specifies configuration options for the Redis-backed distributed sliding window rate limiter.

Miembros (5)

  • propertyConfiguration
    public string Configuration { get; set; }

    Gets or sets the connection configuration string used by StackExchange.Redis.

    Exceptions: ArgumentException: `value` is `null`, empty, or consists only of white-space characters

  • propertyDatabase
    public int Database { get; set; }

    Gets or sets the target Redis database index.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 0 or greater than 15

  • propertyKeyPrefix
    public string KeyPrefix { get; set; }

    Gets or sets the key prefix applied to Redis keys for namespace isolation.

    Exceptions: ArgumentNullException: `value` is `null`

  • propertyMaxPermits
    public int MaxPermits { get; set; }

    Gets or sets the maximum number of permits allowed within the sliding window.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyWindowDuration
    public TimeSpan WindowDuration { get; set; }

    Gets or sets the sliding window duration for rate limiting evaluations.

    Exceptions: ArgumentOutOfRangeException: `value` is less than or equal to `TimeSpan.Zero`

class

RedisSlidingWindowRateLimiter

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisSlidingWindowRateLimiter : IRateLimiter, IAsyncDisposable
Implementa: IAsyncDisposable, IRateLimiter

Controls request rates across distributed application instances using a Redis-backed sliding window algorithm.

Notas:

Algorithm: Sliding window using Redis sorted sets (ZSET). Each request is recorded as a ZSET member with its timestamp as the score. The Lua script atomically removes expired entries, counts current entries, and conditionally adds the new request — all in a single round-trip. This implementation is Native AOT-compatible (no JSON, no reflection).

Miembros (4)

  • constructorRedisSlidingWindowRateLimiter
    public RedisSlidingWindowRateLimiter(IConnectionMultiplexer connection, IOptions<RedisRateLimiterOptions> options, ILogger<RedisSlidingWindowRateLimiter> logger)

    Initializes a new instance of the `RedisSlidingWindowRateLimiter` class using an externally managed connection multiplexer.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer
    options: IOptions<RedisRateLimiterOptions>
    The configuration options accessor for the rate limiter
    logger: ILogger<RedisSlidingWindowRateLimiter>
    The logger used to record operational events

    Exceptions: ArgumentNullException: `connection`, `options`, or `logger` is `null`

  • constructorRedisSlidingWindowRateLimiter
    public RedisSlidingWindowRateLimiter(IConnectionMultiplexer connection, IOptions<RedisRateLimiterOptions> options, ILogger<RedisSlidingWindowRateLimiter> logger, TimeProvider? timeProvider)

    Initializes a new instance of the `RedisSlidingWindowRateLimiter` class using an externally managed connection multiplexer and a custom time provider.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer
    options: IOptions<RedisRateLimiterOptions>
    The configuration options accessor for the rate limiter
    logger: ILogger<RedisSlidingWindowRateLimiter>
    The logger used to record operational events
    timeProvider: TimeProvider?
    The time provider used for window timestamps, or `null` to use `TimeProvider.System`

    Exceptions: ArgumentNullException: `connection`, `options`, or `logger` is `null`

  • methodAcquireAsync
    public async Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

class

RedisTokenBucketRateLimiter

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisTokenBucketRateLimiter : IRateLimiter, IAsyncDisposable
Implementa: IAsyncDisposable, IRateLimiter

Controls request rates across distributed application instances using a Redis-backed token bucket algorithm.

Notas:

This rate limiter executes an atomic Lua script over Redis hashes to continuously replenish tokens and compute quotas in a single round-trip.

Miembros (4)

  • constructorRedisTokenBucketRateLimiter
    public RedisTokenBucketRateLimiter(IConnectionMultiplexer connection, IOptions<RedisTokenBucketRateLimiterOptions> options, ILogger<RedisTokenBucketRateLimiter> logger)

    Initializes a new instance of the `RedisTokenBucketRateLimiter` class using an externally managed Redis connection multiplexer.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer
    options: IOptions<RedisTokenBucketRateLimiterOptions>
    The configuration options accessor for the rate limiter
    logger: ILogger<RedisTokenBucketRateLimiter>
    The logger used to record operational events

    Exceptions: ArgumentNullException: `connection`, `options`, or `logger` is `null`

  • constructorRedisTokenBucketRateLimiter
    public RedisTokenBucketRateLimiter(IConnectionMultiplexer connection, IOptions<RedisTokenBucketRateLimiterOptions> options, ILogger<RedisTokenBucketRateLimiter> logger, TimeProvider? timeProvider)

    Initializes a new instance of the `RedisTokenBucketRateLimiter` class using an externally managed Redis connection multiplexer and a custom time provider.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer
    options: IOptions<RedisTokenBucketRateLimiterOptions>
    The configuration options accessor for the rate limiter
    logger: ILogger<RedisTokenBucketRateLimiter>
    The logger used to record operational events
    timeProvider: TimeProvider?
    The time provider used for replenishment timestamps, or `null` to use `TimeProvider.System`

    Exceptions: ArgumentNullException: `connection`, `options`, or `logger` is `null`

  • methodAcquireAsync
    public async Task<Result<RateLimitLease>> AcquireAsync(string key, int permits = 1, CancellationToken cancellationToken = default)

    Attempts to acquire the specified number of permits for a partition key.

    key: string
    The partition identifier used to isolate rate limit quotas
    permits: int
    The number of permits to acquire. Must be greater than or equal to 1.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation

    Retorna: A task representing the asynchronous operation. The task result contains an operation result encapsulating a `RateLimitLease` indicating whether the permits were granted.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

class

RedisTokenBucketRateLimiterOptions

Ensamblado: EricksonLopez.RateLimiting.Redis
public sealed class RedisTokenBucketRateLimiterOptions

Specifies configuration options for the distributed Redis token bucket rate limiter.

Miembros (6)

  • propertyConfiguration
    public string Configuration { get; set; }

    Gets or sets the connection configuration string used by StackExchange.Redis.

    Exceptions: ArgumentException: `value` is `null`, empty, or consists only of white-space characters

  • propertyDatabase
    public int Database { get; set; }

    Gets or sets the target Redis database index.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 0 or greater than 15

  • propertyKeyPrefix
    public string KeyPrefix { get; set; }

    Gets or sets the key prefix applied to Redis keys for namespace isolation.

    Exceptions: ArgumentNullException: `value` is `null`

  • propertyReplenishmentPeriod
    public TimeSpan ReplenishmentPeriod { get; set; }

    Gets or sets the duration of each replenishment period.

    Exceptions: ArgumentOutOfRangeException: `value` is less than or equal to `TimeSpan.Zero`

  • propertyTokenLimit
    public int TokenLimit { get; set; }

    Gets or sets the maximum number of tokens the bucket can hold.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyTokensPerPeriod
    public int TokensPerPeriod { get; set; }

    Gets or sets the number of tokens restored per replenishment period.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.