コード例 #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 fileName = Path.Combine("key.pem");

            // if (!File.Exists(fileName))
            // {
            //     throw new FileNotFoundException("Signing Certificate is missing!");
            // }

            // var cert = new X509Certificate2(Encoding.UTF8.GetBytes(fileName), "Admin$1234");
            // var secKey = new X509SecurityKey(cert);
            // signingKeys.Add(secKey);

            services.AddControllersWithViews();
            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            //.AddSigningCredential(cert)
            .AddInMemoryApiScopes(Configurations.ApiScopes())
            .AddInMemoryApiResources(Configurations.ApiResources())
            .AddInMemoryClients(Configurations.Clients())
            .AddTestUsers(Configurations.Users().ToList());
        }