Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            // IoC - Service & Repository
            services.AddScoped <ILoginUserService, LoginUserService>();
            services.AddScoped <ILoginUserRepository, LoginUserRepository>();

            // IdentityServer4
            //string basePath = "Path to certifiates";

            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            //.AddSigningCredential(new X509Certificate2(Path.Combine(basePath,
            //    Configuration["Certificates:CerPath"]),
            //    Configuration["Certificates:Password"]))
            //.AddTestUsers(InMemoryConfiguration.GetUsers().ToList())
            .AddInMemoryClients(InMemoryConfiguration.GetClients())
            .AddInMemoryApiResources(InMemoryConfiguration.GetApiResources())
            .AddResourceOwnerValidator <ResourceOwnerPasswordValidator>()
            .AddProfileService <ProfileService>();
        }