Использование Identity Server 4 с сервером SQL - PullRequest
0 голосов
/ 28 апреля 2020

Я установил Identity Server 4 и указал его на SQL Сервер

 string connectionString = Configuration.GetConnectionString("DefaultConnection");
        var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;

        // uncomment, if you want to add an MVC-based UI
        services.AddControllersWithViews();


        var builder = services.AddIdentityServer(options =>
        {
            options.Events.RaiseErrorEvents = true;
            options.Events.RaiseInformationEvents = true;
            options.Events.RaiseFailureEvents = true;
            options.Events.RaiseSuccessEvents = true;
            options.UserInteraction.LoginUrl = "/Account/Login";
            options.UserInteraction.LogoutUrl = "/Account/Logout";
            options.Authentication = new AuthenticationOptions()
            {
                CookieLifetime = TimeSpan.FromHours(10), // ID server cookie timeout set to 10 hours
                CookieSlidingExpiration = true
            };
        })
        .AddConfigurationStore(options =>
        {
            options.ConfigureDbContext = b => b.UseSqlServer(connectionString, sql => sql.MigrationsAssembly(migrationsAssembly));
        })
        .AddOperationalStore(options =>
        {
            options.ConfigureDbContext = b => b.UseSqlServer(connectionString, sql => sql.MigrationsAssembly(migrationsAssembly));
            options.EnableTokenCleanup = true;
        });

Я прошел процедуру настройки сервера. Я настроил сервер, но не знаю, как добавить пользователей в базу данных. Прямо сейчас этот пример использует TestUser с Identity Server. Я не могу узнать, как сохранить или извлечь пользователей из базы данных. Это ручной процесс?

Спасибо.

...