internal static void AddTestAuthentication(this IServiceCollection services, Action <TestAuthenticationOptions> configureOptions) { var authenticationOptions = new TestAuthenticationOptions(); configureOptions(authenticationOptions); services.AddAuthentication( options => { options.DefaultAuthenticateScheme = authenticationOptions.AuthenticationScheme; options.DefaultChallengeScheme = authenticationOptions.AuthenticationScheme; }) .AddScheme <TestAuthenticationOptions, TestAuthenticationHandler>(authenticationOptions.AuthenticationScheme, configureOptions); }
public void AddUser(string name) { TestAuthenticationOptions.SetActiveUser(name); }