Class TestUserAuthenticationExtensions

Namespace
ProtoTest.AspNetCore
Assembly
ProtoTest.AspNetCore.dll

Wires the built-in test user into an in-process application: the shipped handler reads the HeaderName header a test's [SignedInAs] identity travels in and authenticates the request as that user, so the application's own authorization - plain [Authorize], role checks, policies - sees the test user as its principal. The scheme becomes the application's default, replacing whatever the application configured: register it only where a test user should stand in for the application's own authentication, never when the test's subject is that authentication itself. The header only exists while the application runs in-process.

public static class TestUserAuthenticationExtensions
Inheritance
TestUserAuthenticationExtensions
Inherited Members

Fields

Scheme

The authentication scheme the app-side test-user handler registers.

public const string Scheme = "ProtoTest.TestUser"

Field Value

string

Methods

AddTestUserAuthentication(IWebHostBuilder)

Adds the app-side test-user authentication inside an AddAspNetCoreServer web-host callback: app.AddAspNetCoreServer<Program>(webHost => webHost.AddTestUserAuthentication()).

public static IWebHostBuilder AddTestUserAuthentication(this IWebHostBuilder webHost)

Parameters

webHost IWebHostBuilder

Returns

IWebHostBuilder