Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            string connection = Configuration["ConnectionStrings:NorthWindLocalContext"];


            var autSevice = services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme);

            autSevice.AddJwtBearer(options =>
            {
                JwtTokenImplementation.JwtTokenPArameters(options, Configuration);
            });

            services.AddDbContext <DataContext.DataContext>(options => options.UseSqlServer(connection));
            services.AddTransient <IRepositoryBase, Repository>();
            services.AddTransient <IApplicationUserService, ApplicationUserSevice>();
            services.AddTransient <ITokenManagement, TokenManagement>();
            services.AddMvc();


            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var autSevice = services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme);

            autSevice.AddJwtBearer(options =>
            {
                JwtTokenImplementation.JwtTokenPArameters(options, Configuration);
            });
            services.AddTransient <IApplicationUserService, ApplicationUserSevice>();
            services.AddTransient <ITokenManagement, TokenManagement>();
            services.AddMvc();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "My API", Version = "v1"
                });
            });
        }