public void ConfigureServices(IServiceCollection services)
        {
            _services = services;
            services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
                                                          .AllowAnyMethod()
                                                          .AllowAnyHeader()));
            ConfigureLogging(services);
            services.AddLogging();
            var mvcBuilder          = services.AddMvc();
            var externalAuthBuilder = services.AddAuthentication(Constants.ExternalCookieName)
                                      .AddCookie(Constants.ExternalCookieName);
            var twoFactorAuthBuilder = services.AddAuthentication(Constants.TwoFactorCookieName)
                                       .AddCookie(Constants.TwoFactorCookieName);
            var authBuilder = services.AddAuthentication(Constants.CookieName)
                              .AddCookie(Constants.CookieName, opts =>
            {
                opts.LoginPath = "/Authenticate";
            });

            _moduleLoader.ConfigureConnectorAuthentication(externalAuthBuilder);
            _moduleLoader.ConfigureModuleAuthentication(authBuilder);
            services.AddAuthorization(opts =>
            {
                _moduleLoader.ConfigureModuleAuthorization(opts);
            });
            _moduleLoader.ConfigureModuleServices(services, mvcBuilder, _env);
            _moduleLoader.ConfigureTwoFactors(services, mvcBuilder, _env);
        }
Exemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging();
            services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
                                                          .AllowAnyMethod()
                                                          .AllowAnyHeader()));
            var mvc         = services.AddMvc();
            var authBuilder = services.AddAuthentication();

            _moduleLoader.ConfigureModuleServices(services, mvc, _env);
        }