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

## AuthorizationCodeReusePreventingDecorator Class

Enhances token processing by revoking tokens associated with previously used authorization codes,
preventing authorization code reuse in compliance with OAuth 2\.0 security best practices\.

```csharp
public class AuthorizationCodeReusePreventingDecorator : Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → AuthorizationCodeReusePreventingDecorator

Implements [ITokenRequestProcessor](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ITokenRequestProcessor')

### Remarks
This class decorates the standard token request processing flow with additional security measures
to ensure the integrity of the authorization process\. It detects when an authorization code,
which should only be used once, is attempted to be used multiple times\. In such cases, it revokes any
tokens previously issued with that code and denies the request, effectively mitigating potential
security risks associated with code reuse\.
### Constructors

## AuthorizationCodeReusePreventingDecorator\(ITokenRequestProcessor, ITokenRegistry, IAuthorizationCodeService\) Constructor {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.AuthorizationCodeReusePreventingDecorator(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor,Abblix.Oidc.Server.Features.Storages.ITokenRegistry,Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService)}

Enhances token processing by revoking tokens associated with previously used authorization codes,
preventing authorization code reuse in compliance with OAuth 2\.0 security best practices\.

```csharp
public AuthorizationCodeReusePreventingDecorator(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor processor, Abblix.Oidc.Server.Features.Storages.ITokenRegistry tokenRegistry, Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService authorizationCodeService);
```
#### Parameters

###### `processor` [ITokenRequestProcessor](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ITokenRequestProcessor') {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.AuthorizationCodeReusePreventingDecorator(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor,Abblix.Oidc.Server.Features.Storages.ITokenRegistry,Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService).processor}

The underlying token request processor to be enhanced\.

###### `tokenRegistry` [ITokenRegistry](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Storages.ITokenRegistry 'Abblix\.Oidc\.Server\.Features\.Storages\.ITokenRegistry') {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.AuthorizationCodeReusePreventingDecorator(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor,Abblix.Oidc.Server.Features.Storages.ITokenRegistry,Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService).tokenRegistry}

The registry used for managing token states and revocation\.

###### `authorizationCodeService` [IAuthorizationCodeService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService 'Abblix\.Oidc\.Server\.Features\.Storages\.IAuthorizationCodeService') {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.AuthorizationCodeReusePreventingDecorator(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor,Abblix.Oidc.Server.Features.Storages.ITokenRegistry,Abblix.Oidc.Server.Features.Storages.IAuthorizationCodeService).authorizationCodeService}

The service responsible for managing the lifecycle of authorization codes\.

### Remarks
This class decorates the standard token request processing flow with additional security measures
to ensure the integrity of the authorization process\. It detects when an authorization code,
which should only be used once, is attempted to be used multiple times\. In such cases, it revokes any
tokens previously issued with that code and denies the request, effectively mitigating potential
security risks associated with code reuse\.
### Methods

## AuthorizationCodeReusePreventingDecorator\.ProcessAsync\(ValidTokenRequest\) Method {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.ProcessAsync(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest)}

Processes a valid token request, including revoking existing tokens if necessary and registering new tokens\.

```csharp
public System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Endpoints.Token.Interfaces.TokenIssued,Abblix.Oidc.Server.Common.OidcError>> ProcessAsync(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest request);
```
#### Parameters

###### `request` [ValidTokenRequest](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ValidTokenRequest') {#Abblix.Oidc.Server.Endpoints.Token.AuthorizationCodeReusePreventingDecorator.ProcessAsync(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest).request}

The valid token request to process\.

Implements [ProcessAsync\(ValidTokenRequest\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor#Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor.ProcessAsync(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ValidTokenRequest) 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ITokenRequestProcessor\.ProcessAsync\(Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.ValidTokenRequest\)')

#### 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')[TokenIssued](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.TokenIssued 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.TokenIssued')[,](https://learn.microsoft.com/en-us/dotnet/api/abblix.utils.result-2 'Abblix\.Utils\.Result\`2')[OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError')[&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 task that returns a [TokenIssued](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.Token.Interfaces.TokenIssued 'Abblix\.Oidc\.Server\.Endpoints\.Token\.Interfaces\.TokenIssued') on success or an [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') on failure\.
