コード例 #1
0
        public static void Main(string[] args)
        {
            var webHost = CreateHostBuilder(args).Build();

            using (var scope = webHost.Services.CreateScope())
            {
                var userManager   = scope.ServiceProvider.GetRequiredService <UserManager <IdentityUser> >();
                var signInManager = scope.ServiceProvider.GetRequiredService <SignInManager <IdentityUser> >();
                var options       = scope.ServiceProvider.GetRequiredService <IOptions <AppJwtSettings> >();

                var authUser = new AuthUser(userManager, signInManager, options);
                authUser.CreateDefaultUserAdmin("*****@*****.**", "admin").Wait();
            }

            webHost.Run();
        }