// 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)
 {
     //static configuration only for dev purpose
     services.AddIdentityServer()
     .AddInMemoryClients(IdentityServerConfigurations.GetClients())
     .AddInMemoryIdentityResources(IdentityServerConfigurations.GetIdentityResources())
     .AddInMemoryApiResources(IdentityServerConfigurations.GetApiResources())
     .AddTestUsers(IdentityServerConfigurations.GetUsers())
     .AddTemporarySigningCredential();
 }
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)
        {
            // Add DB config
            services.AddDbContext <AplicationDbContext>(options =>
                                                        options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            // Add certificates
            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            .AddInMemoryIdentityResources(IdentityServerConfigurations.GetIdentityResources())     //check below
            .AddInMemoryApiResources(IdentityServerConfigurations.GetApiResources())
            .AddInMemoryClients(IdentityServerConfigurations.GetClients())
            .AddProfileService <ProfileService>();

            // Inject the classes we just created
            services.AddTransient <IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>();
            services.AddTransient <IProfileService, ProfileService>();

            services.Configure <AppConfig>(Configuration.GetSection("AppConfig"));
            services.AddScoped <IUsersService, UsersService>();
        }