Exemple #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();
        }
Exemple #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();
        }