Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void AddUser(string name)
 {
     TestAuthenticationOptions.SetActiveUser(name);
 }