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

## EnabledByConvention Class

Application model convention that removes controllers and actions from the application model if their required
OIDC endpoint is disabled in configuration\.

```csharp
public class EnabledByConvention : Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelConvention
```

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

Implements [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.iapplicationmodelconvention 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention')

### Remarks
This convention checks for the [EnabledByAttribute](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.Filters.EnabledByAttribute 'Abblix\.Oidc\.Server\.Mvc\.Filters\.EnabledByAttribute') on controllers and actions, removing
them from the application model if the specified endpoint is not enabled in [EnabledEndpoints](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions#Abblix.Oidc.Server.Common.Configuration.OidcOptions.EnabledEndpoints 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions\.EnabledEndpoints')\.
This prevents controllers and actions from being registered at all, rather than returning 404 at runtime\.
### Constructors

## EnabledByConvention\(IOptions\<OidcOptions\>\) Constructor {#Abblix.Oidc.Server.Mvc.Conventions.EnabledByConvention.EnabledByConvention(Microsoft.Extensions.Options.IOptions_Abblix.Oidc.Server.Common.Configuration.OidcOptions_)}

Application model convention that removes controllers and actions from the application model if their required
OIDC endpoint is disabled in configuration\.

```csharp
public EnabledByConvention(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.Mvc.Conventions.EnabledByConvention.EnabledByConvention(Microsoft.Extensions.Options.IOptions_Abblix.Oidc.Server.Common.Configuration.OidcOptions_).options}

### Remarks
This convention checks for the [EnabledByAttribute](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.Filters.EnabledByAttribute 'Abblix\.Oidc\.Server\.Mvc\.Filters\.EnabledByAttribute') on controllers and actions, removing
them from the application model if the specified endpoint is not enabled in [EnabledEndpoints](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions#Abblix.Oidc.Server.Common.Configuration.OidcOptions.EnabledEndpoints 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions\.EnabledEndpoints')\.
This prevents controllers and actions from being registered at all, rather than returning 404 at runtime\.
### Methods

## EnabledByConvention\.Apply\(ApplicationModel\) Method {#Abblix.Oidc.Server.Mvc.Conventions.EnabledByConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel)}

Walks the MVC application model and removes any controller or action whose
[EnabledByAttribute](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.Filters.EnabledByAttribute 'Abblix\.Oidc\.Server\.Mvc\.Filters\.EnabledByAttribute') targets an endpoint flag that is not set in
[EnabledEndpoints](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Configuration.OidcOptions#Abblix.Oidc.Server.Common.Configuration.OidcOptions.EnabledEndpoints 'Abblix\.Oidc\.Server\.Common\.Configuration\.OidcOptions\.EnabledEndpoints')\. Removed entries are not registered as routes,
so requests to them produce a routing 404 \(no handler\) rather than a runtime filter rejection\.

```csharp
public void Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel application);
```
#### Parameters

###### `application` [Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.applicationmodel 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel') {#Abblix.Oidc.Server.Mvc.Conventions.EnabledByConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModel).application}

Implements [Apply\(ApplicationModel\)](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.iapplicationmodelconvention.apply#microsoft-aspnetcore-mvc-applicationmodels-iapplicationmodelconvention-apply(microsoft-aspnetcore-mvc-applicationmodels-applicationmodel) 'Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.IApplicationModelConvention\.Apply\(Microsoft\.AspNetCore\.Mvc\.ApplicationModels\.ApplicationModel\)')
