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

## UserCodeValidator Class

Validates the presence of a UserCode in backchannel authentication requests, based on the client
and provider configuration\. This validator ensures that if the client or provider requires the
UserCode parameter for backchannel authentication, it is included in the request\.

```csharp
public class UserCodeValidator : Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.IBackChannelAuthenticationContextValidator
```

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

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

### Remarks
This validator checks \<em\>presence\</em\> only\. Verifying the code's \<em\>value\</em\> against the
user's actual code is the host's responsibility and happens during the device interaction — see
the security contract on
[IUserDeviceAuthenticationHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IUserDeviceAuthenticationHandler 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.Interfaces\.IUserDeviceAuthenticationHandler')\.
### Constructors

## UserCodeValidator\(IOptions\<OidcOptions\>\) Constructor {#Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.UserCodeValidator.UserCodeValidator(Microsoft.Extensions.Options.IOptions_Abblix.Oidc.Server.Common.Configuration.OidcOptions_)}

Validates the presence of a UserCode in backchannel authentication requests, based on the client
and provider configuration\. This validator ensures that if the client or provider requires the
UserCode parameter for backchannel authentication, it is included in the request\.

```csharp
public UserCodeValidator(Microsoft.Extensions.Options.IOptions<Abblix.Oidc.Server.Common.Configuration.OidcOptions> options);
```
#### Parameters

###### `options` [Microsoft\.Extensions\.Options\.IOptions&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1')[OidcOptions](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1') {#Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.UserCodeValidator.UserCodeValidator(Microsoft.Extensions.Options.IOptions_Abblix.Oidc.Server.Common.Configuration.OidcOptions_).options}

The OIDC options used to configure the behavior of the backchannel authentication process\.

### Remarks
This validator checks \<em\>presence\</em\> only\. Verifying the code's \<em\>value\</em\> against the
user's actual code is the host's responsibility and happens during the device interaction — see
the security contract on
[IUserDeviceAuthenticationHandler](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IUserDeviceAuthenticationHandler 'Abblix\.Oidc\.Server\.Features\.BackChannelAuthentication\.Interfaces\.IUserDeviceAuthenticationHandler')\.
### Methods

## UserCodeValidator\.ValidateAsync\(BackChannelAuthenticationValidationContext\) Method {#Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.UserCodeValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.BackChannelAuthenticationValidationContext)}

Asynchronously validates the UserCode parameter in the context of a backchannel authentication request\.
If the UserCode is required but not present, the method returns an error\. Otherwise, it returns null\.

```csharp
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Common.OidcError?> ValidateAsync(Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.BackChannelAuthenticationValidationContext context);
```
#### Parameters

###### `context` [BackChannelAuthenticationValidationContext](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.BackChannelAuthenticationValidationContext 'Abblix\.Oidc\.Server\.Endpoints\.BackChannelAuthentication\.Validation\.BackChannelAuthenticationValidationContext') {#Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.UserCodeValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.BackChannelAuthenticationValidationContext).context}

The validation context containing the authentication request and client information\.

Implements [ValidateAsync\(BackChannelAuthenticationValidationContext\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.IBackChannelAuthenticationContextValidator#Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.IBackChannelAuthenticationContextValidator.ValidateAsync(Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Validation.BackChannelAuthenticationValidationContext) 'Abblix\.Oidc\.Server\.Endpoints\.BackChannelAuthentication\.Validation\.IBackChannelAuthenticationContextValidator\.ValidateAsync\(Abblix\.Oidc\.Server\.Endpoints\.BackChannelAuthentication\.Validation\.BackChannelAuthenticationValidationContext\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[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/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A task that returns an error if validation fails,
or null if successful\.
