#### [Abblix\.Oidc\.Server](https://www.abblix.com/en/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.Interfaces')

## IUserCodeRateLimiter Interface

Defines the contract for rate limiting user code verification attempts to prevent brute force attacks\.
Per RFC 8628 Section 5\.2, implementations SHOULD implement rate limiting to prevent abuse\.

```csharp
public interface IUserCodeRateLimiter
```

Derived  
↳ [UserCodeRateLimiter](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeRateLimiter 'Abblix\.Oidc\.Server\.Features\.DeviceAuthorization\.UserCodeRateLimiter')
### Methods

## IUserCodeRateLimiter\.CheckAsync\(string, string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.CheckAsync(string,string)}

Checks if a verification attempt should be allowed for the given user code and client identifier\.
Implements exponential backoff and per\-IP rate limiting to prevent brute force attacks\.

```csharp
System.Threading.Tasks.Task<Abblix.Utils.Result<bool,System.TimeSpan>> CheckAsync(string userCode, string clientIdentifier);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.CheckAsync(string,string).userCode}

The user code being verified\.

###### `clientIdentifier` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.CheckAsync(string,string).clientIdentifier}

The client identifier \(IP address or other identifier\)\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[Abblix\.Utils\.Result&lt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')[,](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A [Abblix\.Utils\.Result&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2') containing:
\- Success \(`true`\): The verification attempt is allowed to proceed\.
\- Failure \([System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')\): The attempt is rate limited; the value indicates the duration
  the client must wait before retrying \(Retry\-After\)\.

## IUserCodeRateLimiter\.RecordFailureAsync\(string, string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordFailureAsync(string,string)}

Records a failed verification attempt for rate limiting purposes\.

```csharp
System.Threading.Tasks.Task RecordFailureAsync(string userCode, string clientIdentifier);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordFailureAsync(string,string).userCode}

The user code that failed verification\.

###### `clientIdentifier` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordFailureAsync(string,string).clientIdentifier}

The client identifier \(IP address or other identifier\)\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')

## IUserCodeRateLimiter\.RecordSuccessAsync\(string, string\) Method {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordSuccessAsync(string,string)}

Records a successful verification to reset rate limiting counters\.

```csharp
System.Threading.Tasks.Task RecordSuccessAsync(string userCode, string clientIdentifier);
```
#### Parameters

###### `userCode` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordSuccessAsync(string,string).userCode}

The user code that was successfully verified\.

###### `clientIdentifier` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter.RecordSuccessAsync(string,string).clientIdentifier}

The client identifier \(IP address or other identifier\)\.

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')
