Example #1
0
        /// <summary>
        /// Мод "IdentityServer". Веб. Расширение. Настроить. Аутентификацию.
        /// </summary>
        /// <param name="services">Сервисы.</param>
        /// <param name="configSettings">Кнфигурационные настройки.</param>
        public static AuthenticationBuilder ModIdentityServerWebExtConfigureAuthentication(
            this IServiceCollection services,
            IModIdentityServerBaseConfigSettings configSettings
            )
        {
            var apiResources      = CreateApiResources(configSettings.ApiResources);
            var clients           = CreateClients(configSettings.Clients);
            var identityResources = CreateIdentityResources(configSettings.IdentityResources);

            var builder = services.AddIdentityServer(options =>
            {
                options.Events.RaiseErrorEvents       = true;
                options.Events.RaiseInformationEvents = true;
                options.Events.RaiseFailureEvents     = true;
                options.Events.RaiseSuccessEvents     = true;
            })
                          .AddInMemoryIdentityResources(identityResources)
                          .AddInMemoryApiResources(apiResources)
                          .AddInMemoryClients(clients)
                          .AddAspNetIdentity <DataEntityObjectUser>()
                          .AddProfileService <ModIdentityServerBasePartProfileService>();

            // not recommended for production - you need to store your key material somewhere secure
            builder.AddDeveloperSigningCredential();

            return(services.AddAuthentication());
        }
        /// <summary>
        /// Конструктор.
        /// </summary>
        /// <param name="environment">Окружение.</param>
        public ModIdentityServerBaseConfig(CoreBaseEnvironment environment)
        {
            Environment = environment;

            FilePath = CreateFilePath();

            Settings = ModIdentityServerBaseConfigSettings.Create(FilePath, Environment);
        }
Example #3
0
 /// <summary>
 /// Мод "IdentityServer". Веб. Аутентификация. Включить.
 /// </summary>
 /// <param name="configSettings">Конфигурационные настройки.</param>
 public void ModIdentityServerWebAuthenticationEnable(IModIdentityServerBaseConfigSettings configSettings)
 {
     ModIdentityServerBaseConfigSettings = configSettings;
 }