Example #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)
        {
            var cert = new X509Certificate2
                           (Path.Combine(webHostEnvironmentv.ContentRootPath,
                                         configuration["IdentityServer:FileName"]),
                           configuration["IdentityServer:Password"],
                           X509KeyStorageFlags.MachineKeySet);

            services.AddIdentityServer()
            .AddInMemoryIdentityResources(IdentityConfig.GetIdentityResources())
            .AddInMemoryApiScopes(IdentityConfig.ApiScopes)
            .AddInMemoryApiResources(IdentityConfig.ApiResources)
            .AddInMemoryClients(IdentityConfig.GetClients())
            .AddTestUsers(IdentityConfig.GestUsers())
            .AddSigningCredential(cert)
            //.AddDeveloperSigningCredential()
            ;
        }