public GetShowCertificationsRecurringJob(AppDbContext appDbContext, TraktAPIConfiguration traktApiConfiguration) { _appDbContext = appDbContext; _traktApiConfiguration = traktApiConfiguration; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, _traktApiConfiguration.ClientSecret); }
public GetMovieGenresRecurringJob(AppDbContext appDbContext, TraktAPIConfiguration traktApiConfiguration) { _appDbContext = appDbContext; _traktApiConfiguration = traktApiConfiguration; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, _traktApiConfiguration.ClientSecret); }
public GetShowCertificationsRecurringJob(TraktAPIConfiguration traktApiConfiguration, ITraktShowRepository traktShowRepository) { _traktApiConfiguration = traktApiConfiguration; _traktShowRepository = traktShowRepository; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, _traktApiConfiguration.ClientSecret); }
public GetMovieGenresRecurringJob(TraktAPIConfiguration traktApiConfiguration, ITraktMovieRepository traktMovieRepository) { _traktApiConfiguration = traktApiConfiguration; _traktMovieRepository = traktMovieRepository; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, _traktApiConfiguration.ClientSecret); }
public TraktService(UserManager <User> userManager, IHttpContextAccessor httpContextAccessor, TraktAPIConfiguration traktApiConfiguration) { _userManager = userManager; _httpContextAccessor = httpContextAccessor; _traktApiConfiguration = traktApiConfiguration; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, traktApiConfiguration.ClientSecret); }
public TraktListAPIRepository(UserManager <IdentityUser> userManager, IHttpContextAccessor httpContextAccessor, TraktAPIConfiguration traktApiConfiguration) { _userManager = userManager; _httpContextAccessor = httpContextAccessor; _traktApiConfiguration = traktApiConfiguration; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, traktApiConfiguration.ClientSecret); }
public TraktService(UserManager <User> userManager, IHttpContextAccessor httpContextAccessor, TraktAPIConfiguration traktApiConfiguration) { _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); _traktApiConfiguration = traktApiConfiguration ?? throw new ArgumentNullException(nameof(traktApiConfiguration)); _traktClient = new TraktClient(_traktApiConfiguration.ClientId, traktApiConfiguration.ClientSecret); }
public TraktService(UserManager <User> userManager, IHttpContextAccessor httpContextAccessor, TraktAPIConfiguration traktApiConfiguration, IUserLimitService userLimitService, IIMDbRepository imDbRepository) { _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); _traktApiConfiguration = traktApiConfiguration ?? throw new ArgumentNullException(nameof(traktApiConfiguration)); _userLimitService = userLimitService ?? throw new ArgumentNullException(nameof(userLimitService)); _imDbRepository = imDbRepository ?? throw new ArgumentNullException(nameof(imDbRepository)); _traktClient = new TraktClient(_traktApiConfiguration.ClientId, traktApiConfiguration.ClientSecret); }
public ProcessMovieListBackgroundJob(ITraktService traktService, TraktAPIConfiguration traktApiConfiguration, ITraktListRepository traktRepository) { _traktService = traktService; _traktRepository = traktRepository; _traktApiConfiguration = traktApiConfiguration; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var connectionString = Configuration.GetConnectionString("DefaultConnection"); // Config var hangfireConfiguration = new HangFireConfiguration(); Configuration.Bind("Hangfire", hangfireConfiguration); services.AddSingleton(hangfireConfiguration); var listPaginationConfiguration = new ListPaginationConfiguration(); Configuration.Bind("ListPagination", listPaginationConfiguration); services.AddSingleton(listPaginationConfiguration); var traktApiConfiguration = new TraktAPIConfiguration(); Configuration.Bind("Trakt", traktApiConfiguration); services.AddSingleton(traktApiConfiguration); var githubApiConfiguration = new GithubAPIConfiguration(); Configuration.Bind("GitHub", githubApiConfiguration); services.AddSingleton(githubApiConfiguration); var limitConfigurationList = new LimitConfigurationList(); Configuration.Bind("LimitConfig", limitConfigurationList); services.AddSingleton(limitConfigurationList); var userMappingConfigurationList = new UserMappingConfigurationList(); Configuration.Bind("UserMappingConfig", userMappingConfigurationList); services.AddSingleton(userMappingConfigurationList); // Multi Instance LB services.AddDbContext <DataProtectionDbContext>(options => options.UseSqlServer(connectionString) ); services.AddDataProtection() .PersistKeysToDbContext <DataProtectionDbContext>() .SetApplicationName("Listrr"); services.AddDistributedSqlServerCache(options => { options.ConnectionString = connectionString; options.SchemaName = "dbo"; options.TableName = "Cache"; }); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <AppDbContext>(options => options.UseSqlServer(connectionString) ); services.AddDefaultIdentity <User>(options => { options.User.AllowedUserNameCharacters = null; }).AddEntityFrameworkStores <AppDbContext>(); services.AddHangfire(x => x.UseSqlServerStorage(connectionString)); services.AddAuthentication() .AddTrakt(options => { options.ClientId = traktApiConfiguration.ClientId; options.ClientSecret = traktApiConfiguration.ClientSecret; options.SaveTokens = true; options.ClaimActions.MapJsonSubKey(Constants.Trakt_Claim_Ids_Slug, "ids", "slug"); options.Events.OnCreatingTicket = ctx => { List <AuthenticationToken> tokens = ctx.Properties.GetTokens() as List <AuthenticationToken>; tokens.Add(new AuthenticationToken() { Name = "TicketCreated", Value = DateTime.Now.ToString() }); ctx.Properties.StoreTokens(tokens); return(Task.CompletedTask); }; }) .AddGitHub(options => { options.ClientId = githubApiConfiguration.ClientId; options.ClientSecret = githubApiConfiguration.ClientSecret; options.SaveTokens = true; options.Events.OnCreatingTicket = ctx => { List <AuthenticationToken> tokens = ctx.Properties.GetTokens() as List <AuthenticationToken>; tokens.Add(new AuthenticationToken() { Name = "TicketCreated", Value = DateTime.Now.ToString() }); ctx.Properties.StoreTokens(tokens); return(Task.CompletedTask); }; }); services.ConfigureApplicationCookie(options => { // Cookie settings options.Cookie.Name = "Listrr"; options.Cookie.HttpOnly = true; options.ExpireTimeSpan = TimeSpan.FromHours(1); options.LoginPath = "/Identity/Account/Login"; options.AccessDeniedPath = "/Identity/Account/AccessDenied"; options.SlidingExpiration = true; }); services.AddHttpContextAccessor(); //ReverseProxy Fix services.Configure <ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; }); services.AddScoped <IGitHubGraphService, GitHubGraphService>(); services.AddScoped <IBackgroundJobQueueService, BackgroundJobQueueService>(); services.AddScoped <ITraktListRepository, TraktListRepository>(); services.AddScoped <ITraktMovieRepository, TraktMovieRepository>(); services.AddScoped <ITraktShowRepository, TraktShowRepository>(); services.AddScoped <ITraktCodeRepository, TraktCodeRepository>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <ITraktService, TraktService>(); services.AddControllersWithViews(); services.AddRazorPages(); }
public void CreateTraktServiceWithNullParametersThowsNullReferenceException(UserManager <User> userManager, IHttpContextAccessor httpContextAccessor, TraktAPIConfiguration traktApiConfiguration) { // Arrange // Act // Assert Assert.Throws <ArgumentNullException>(() => { new TraktService(userManager, httpContextAccessor, traktApiConfiguration); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var connectionString = Configuration.GetConnectionString("DefaultConnection"); // Config var hangfireConfiguration = new HangFireConfiguration(); Configuration.Bind("Hangfire", hangfireConfiguration); services.AddSingleton(hangfireConfiguration); var toplistConfiguration = new ToplistConfiguration(); Configuration.Bind("Toplist", toplistConfiguration); services.AddSingleton(toplistConfiguration); var traktApiConfiguration = new TraktAPIConfiguration(); Configuration.Bind("Trakt", traktApiConfiguration); services.AddSingleton(traktApiConfiguration); // Multi Instance LB services.AddDbContext <DataProtectionDbContext>(options => options.UseSqlServer(connectionString) ); services.AddDataProtection() .PersistKeysToDbContext <DataProtectionDbContext>() .SetApplicationName("Listrr"); services.AddDistributedSqlServerCache(options => { options.ConnectionString = connectionString; options.SchemaName = "dbo"; options.TableName = "Cache"; }); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <AppDbContext>(options => options.UseSqlServer(connectionString) ); services.AddDefaultIdentity <IdentityUser>(options => { options.User.AllowedUserNameCharacters = null; }).AddEntityFrameworkStores <AppDbContext>(); services.AddHangfire(x => x.UseSqlServerStorage(connectionString)); services.AddAuthentication() .AddTrakt(options => { options.ClientId = traktApiConfiguration.ClientId; options.ClientSecret = traktApiConfiguration.ClientSecret; options.SaveTokens = true; options.Events.OnCreatingTicket = ctx => { List <AuthenticationToken> tokens = ctx.Properties.GetTokens() as List <AuthenticationToken>; tokens.Add(new AuthenticationToken() { Name = "TicketCreated", Value = DateTime.Now.ToString() }); ctx.Properties.StoreTokens(tokens); return(Task.CompletedTask); }; }); services.ConfigureApplicationCookie(options => { // Cookie settings options.Cookie.Name = "Listrr"; options.Cookie.HttpOnly = true; options.ExpireTimeSpan = TimeSpan.FromHours(1); options.LoginPath = "/Identity/Account/Login"; options.AccessDeniedPath = "/Identity/Account/AccessDenied"; options.SlidingExpiration = true; }); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddHttpContextAccessor(); services.Configure <ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; }); services.AddScoped <ITraktListDBRepository, TraktListDBRepository>(); services.AddScoped <ITraktListAPIRepository, TraktListAPIRepository>(); services.AddScoped <ITraktService, TraktService>(); }
public GetShowGenresRecurringJob(TraktAPIConfiguration traktApiConfiguration) { _traktApiConfiguration = traktApiConfiguration; _traktClient = new TraktClient(_traktApiConfiguration.ClientId, _traktApiConfiguration.ClientSecret); }