Ejemplo n.º 1
0
 public static async Task PerormPreflightOperations(IWebHost host, string[] args)
 {
     if (args.Contains("--seed") || args.Contains("-s"))
     {
         using (IServiceScope scope = host.Services.CreateScope())
         {
             IServiceProvider     services  = scope.ServiceProvider;
             BudgetTrackerContext context   = services.GetRequiredService <BudgetTrackerContext>();
             IConfiguration       appConfig = services.GetRequiredService <IConfiguration>();
             BasicSeed            seeder    = new BasicSeed(context, appConfig);
             await seeder.Seed();
         }
     }
 }
Ejemplo n.º 2
0
 public ServiceBase(BudgetTrackerContext context, IJwtService jwtService)
 {
     _context    = context;
     _jwtService = jwtService;
 }
Ejemplo n.º 3
0
 public IncomeService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService)
 {
 }
Ejemplo n.º 4
0
 public CategoryService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService)
 {
 }
Ejemplo n.º 5
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <User> userManager, BudgetTrackerContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseCors(builder => builder
                            .AllowAnyOrigin()
                            .AllowAnyMethod()
                            .AllowAnyHeader());
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseCors(builder => builder
                            .AllowAnyOrigin()
                            .AllowAnyMethod()
                            .AllowAnyHeader());
                app.UseHsts();
                app.UseHttpsRedirection();
            }

            app.UseOpenApi(options =>
            {
                options.DocumentName = "swagger";
                options.Path         = "/swagger/v1/swagger.json";
                options.PostProcess  = (document, _) =>
                {
                    document.Schemes.Add(OpenApiSchema.Https);
                };
            });

            app.UseRouting();

            app.UseSwaggerUi3(options =>
            {
                options.DocumentPath = "/swagger/v1/swagger.json";
            });

            app.UseAuthentication();
            app.UseAuthorization();

            DatabaseSeeder.SeedData(userManager, context);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
 public AuthenticationService(BudgetTrackerContext context, SignInManager <User> signInManager,
                              UserManager <User> userManager, IJwtService jwtService) : base(context, jwtService)
 {
     _signInManager = signInManager;
     _userManager   = userManager;
 }
Ejemplo n.º 7
0
 public JwtService(IOptions <AppSettings> appSettings, IHttpContextAccessor httpContextAccessor, BudgetTrackerContext context)
 {
     _appSettings = appSettings.Value;
     _context     = context;
     _token       = httpContextAccessor.HttpContext.Request.Headers["Authorization"];
 }
Ejemplo n.º 8
0
 public ExpenseService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService)
 {
 }