Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <DirectoryDbSettings>(Configuration.GetSection(nameof(DirectoryDbSettings)));
            services.AddSingleton <IDirectoryDbSettings>(sp =>
                                                         sp.GetRequiredService <IOptions <DirectoryDbSettings> >().Value);

            services.AddMvc();
            services.AddAuthentication()
            .AddOpenIdConnectServer(options =>
            {
                options.Provider = new AuthorizationProvider();
                options.AuthorizationEndpointPath = "/connect/authorize";
                options.TokenEndpointPath         = "/connect/token";
                options.AllowInsecureHttp         = true;
            });

            /*
             * services.AddDistributedRedisCache(option =>
             * {
             *  option.Configuration = Configuration["ExternalConnections:RedisConnection"];
             *  option.InstanceName = "master";
             * });*/

            ServiceDependencyResolver.Resolve(services);
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <DirectoryDbSettings>(Configuration.GetSection(nameof(DirectoryDbSettings)));
            services.AddSingleton <IDirectoryDbSettings>(sp =>
                                                         sp.GetRequiredService <IOptions <DirectoryDbSettings> >().Value);

            services.AddMvc();
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>
            {
                options.LoginPath = "/account/login";
            });

            /*services.AddDistributedRedisCache(option =>
             * {
             *  option.Configuration = Configuration["ExternalConnections:RedisConnection"];
             *  option.InstanceName = "master";
             * });*/

            ServiceDependencyResolver.Resolve(services);
        }