# Class ServiceExtension

Namespace
  adas_core.Configurations

Assembly
  adas-core.dll

Provides static extension methods for service-related operations.

    public static class ServiceExtension

Inheritance
  object
  ServiceExtension

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Methods

### ConfigureJwtAuthentication(WebApplicationBuilder)

Configures JWT Bearer authentication and authorization on the provided WebApplicationBuilder using settings bound from the "AuthSettings" configuration section. If the JWT configuration is missing, the method returns without making changes; if the secret key is empty, an error is logged and an exception is thrown.

    public static void ConfigureJwtAuthentication(this WebApplicationBuilder builder)

#### Parameters

`builder` WebApplicationBuilder

  The WebApplicationBuilder to which authentication and authorization services are added.

#### Exceptions

Exception

  Thrown when the JWT signing key is not configured in the application settings.

### CreateConfigEntitiesFromAppSettingsSections(WebApplicationBuilder)

Registers application configuration sections as strongly-typed options in the dependency injection container, binding Database, RabbitMQ, Providers, Recording, Relay, Api, Auth, Redis, Cache, and List settings to the corresponding configuration sections.

    public static void CreateConfigEntitiesFromAppSettingsSections(this WebApplicationBuilder builder)

#### Parameters

`builder` WebApplicationBuilder

  The WebApplicationBuilder whose services and configuration are used to register the option bindings.

### UseProxyDevices(WebApplicationBuilder)

Registers the proxy device service and its configuration in the application's dependency injection container, binding ProxyDeviceSettings from the "ProxyDevicesSettings" configuration section.

    public static void UseProxyDevices(this WebApplicationBuilder builder)

#### Parameters

`builder` WebApplicationBuilder

  The WebApplicationBuilder used to configure services and application settings.

#### Exceptions

ArgumentNullException

  Thrown when `builder` is `null`.