Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();

            services.AddMvc();

            DiContainer.AddCustomServices(services);

            services.AddScoped <IDbInitializer, DbInitializer>();

            services.AddAuthentication()
            .AddJwtBearer(cfg =>
            {
                cfg.RequireHttpsMetadata = false;
                cfg.SaveToken            = true;

                cfg.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidIssuer      = JwtConfigConstants.Issuer,
                    ValidateAudience = false,
                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("LONG_LONG_HARD_KEY_1234567890"))
                };
            });
        }