Ejemplo n.º 1
0
        private static void InitializeConfiguration(IServiceCollection serviceCollection)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", false, true);

            var configuration = builder.Build();

            var udemyUrlConfigurationSection = new UdemyUrlConfigurationSection();

            configuration.GetSection(nameof(UdemyUrlConfigurationSection)).Bind(udemyUrlConfigurationSection);
            serviceCollection.AddSingleton(udemyUrlConfigurationSection);

            var udemyRegexConfigurationSection = new UdemyRegexConfigurationSection();

            configuration.GetSection(nameof(UdemyRegexConfigurationSection)).Bind(udemyRegexConfigurationSection);
            serviceCollection.AddSingleton(udemyRegexConfigurationSection);
        }
 public AuthenticationService(UdemyUrlConfigurationSection udemyUrlConfigurationSection, ICsrfTokenExtractor tokenExtractor)
 {
     _udemyUrlConfigurationSection = udemyUrlConfigurationSection;
     _tokenExtractor = tokenExtractor;
 }