// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //Autofac, Ninject, CastleWindsor, StructureMap, LightInject, DryInject -->Ioc Container //AOP services.AddControllersWithViews(); //Singleton => Bellekte 1 tane Product oluþturuyor. IProduct istediði zaman arkada newleyip productManager dönderiyor. //services.AddSingleton<IProductService,ProductManager>(); //services.AddSingleton<IProductDal, EfProductDal>(); var tokenOptions = Configuration.GetSection("TokenOptions").Get <TokenOptions>(); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidIssuer = tokenOptions.Issuer, ValidAudience = tokenOptions.Audience, ValidateIssuerSigningKey = true, IssuerSigningKey = SecurityKeyHelper.CreatSecurityKey(tokenOptions.SecurityKey) }; }); ServiceTool.Create(services); }