Table of Contents

Class DemoIdentityServiceExtensions

Namespace
ReferenceApplication.Web.Authentication.Extensions
Assembly
ReferenceApplication.Web.dll

Registers and maps the explicitly enabled, Development-only demo identity control.

public static class DemoIdentityServiceExtensions
Inheritance
DemoIdentityServiceExtensions
Inherited Members

Methods

AddApplicationDemoIdentity(IServiceCollection, IConfiguration, IHostEnvironment)

Adds the demo identity service only when the host is running in Development and the explicit switch is enabled.

public static IServiceCollection AddApplicationDemoIdentity(this IServiceCollection services, IConfiguration configuration, IHostEnvironment environment)

Parameters

services IServiceCollection

The service collection to configure.

configuration IConfiguration

The application configuration.

environment IHostEnvironment

The host environment.

Returns

IServiceCollection

The same service collection for chaining.

IsDemoIdentityActive(IConfiguration, IHostEnvironment)

Determines whether the demo identity control is active for the supplied host configuration.

public static bool IsDemoIdentityActive(IConfiguration configuration, IHostEnvironment environment)

Parameters

configuration IConfiguration

The application configuration.

environment IHostEnvironment

The host environment.

Returns

bool

true only for Development with the explicit switch enabled.

MapApplicationDemoIdentity(WebApplication)

Maps the demo sign-in endpoint when the demo identity service was registered.

public static WebApplication MapApplicationDemoIdentity(this WebApplication app)

Parameters

app WebApplication

The application whose endpoint should be mapped.

Returns

WebApplication

The same application for chaining.

UseApplicationDemoDatabase(WebApplicationBuilder)

Selects the disposable SQLite database before data-access services are registered when the Development demo is active. Non-Development and disabled hosts retain their configured provider and connection string.

public static WebApplicationBuilder UseApplicationDemoDatabase(this WebApplicationBuilder builder)

Parameters

builder WebApplicationBuilder

The application builder to configure.

Returns

WebApplicationBuilder

The same builder for chaining.