public BasicAuthenticationHandler(
     IOptionsMonitor <AuthenticationSchemeOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock,
     CodingTaskContext context,
     IHashService hashService)
     : base(options, logger, encoder, clock)
 {
     this.context     = context;
     this.hashService = hashService;
 }
Exemple #2
0
 public MatchService(CodingTaskContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemple #3
0
 public ArenasController(CodingTaskContext context)
 {
     _context = context;
 }
Exemple #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHashService hashService, CodingTaskContext context,
                              ILoggerFactory loggerFactory, IClock clock)
        {
            // initialize database
            try {
                context.Initialize(hashService, clock).Wait();
            } catch (Exception ex) {
                var logger = loggerFactory.CreateLogger("startup");
                logger.LogError(ex, "An error occurred creating the DB.");
            }

            // global cors policy
            app.UseCors(x => x
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .SetIsOriginAllowed(origin => true) // allow any origin
                        .AllowCredentials());               // allow credentials

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles(new StaticFileOptions {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(env.ContentRootPath, "Views")),
                RequestPath = "/Views"
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c => {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Cleverbit V1");
                c.RoutePrefix = string.Empty;
            });

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

            app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
            });
        }
 public UserMatchRepository(CodingTaskContext dbContext) : base(dbContext)
 {
 }
Exemple #6
0
 public Repository(CodingTaskContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Exemple #7
0
 public MatchService(CodingTaskContext db, IScoreGenerator scoreGenerator, IClock clock)
 {
     this.db             = db;
     this.scoreGenerator = scoreGenerator;
     this.clock          = clock;
 }
 public AuthenticationService(CodingTaskContext db, IHashService hashService)
 {
     this.db          = db;
     this.hashService = hashService;
 }
 public Repository(CodingTaskContext _dbContext)
 {
     dbContext = _dbContext;
 }
 public UnitOfWork(CodingTaskContext context) =>
Exemple #11
0
 public PlayRepository(CodingTaskContext dbContext) : base(dbContext)
 {
 }
Exemple #12
0
 public LoginController(CodingTaskContext context)
 {
 }