Beispiel #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.AddControllersWithViews();

            services.AddIdentityServer(options =>
            {
                var configuredOptions = Config.GetServerOptions();
                MergeHelper.Merge(configuredOptions, options);
            })
            .AddDeveloperSigningCredential()
            .AddInMemoryIdentityResources(Config.GetIdentityResources())
            .AddInMemoryApiResources(Config.GetApiResources())
            .AddInMemoryApiScopes(Config.GetApiScopes())
            .AddInMemoryClients(Config.GetClients())
            .AddTestUsers(Config.GetUsers())
            .AddRedirectUriValidator <RedirectUriValidator>()
            .AddProfileService <ProfileService>()
            .AddCorsPolicyService <CorsPolicyService>();

            var aspNetServicesOptions = Config.GetAspNetServicesOptions();

            AspNetServicesHelper.ConfigureAspNetServices(services, aspNetServicesOptions);

            services.AddRouting();
        }
Beispiel #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.AddControllersWithViews().AddNewtonsoftJson(options => {
                options.SerializerSettings.ContractResolver = new DefaultContractResolver();
                options.SerializerSettings.Converters.Add(new ClaimJsonConverter());
            });

            services.AddIdentityServer(options =>
            {
                var configuredOptions = Config.GetServerOptions();
                MergeHelper.Merge(configuredOptions, options);
            })
            .AddDeveloperSigningCredential()
            .AddInMemoryIdentityResources(Config.GetIdentityResources())
            .AddInMemoryApiResources(Config.GetApiResources())
            .AddInMemoryApiScopes(Config.GetApiScopes())
            .AddInMemoryClients(Config.GetClients())
            .AddTestUsers(Config.GetUsers())
            .AddRedirectUriValidator <RedirectUriValidator>()
            .AddProfileService <ProfileService>()
            .AddCorsPolicyService <CorsPolicyService>();

            var aspNetServicesOptions = Config.GetAspNetServicesOptions();

            AspNetServicesHelper.ConfigureAspNetServices(services, aspNetServicesOptions);

            Config.ConfigureAccountOptions();

            services.AddRouting();
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();

            var aspNetServicesOptions = Config.GetAspNetServicesOptions();

            AspNetServicesHelper.UseAspNetServices(app, aspNetServicesOptions);

            app.UseIdentityServer();
            app.UseStaticFiles();
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
            });
        }