// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddAuthentication( CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddAuthorization(options => { options.AddPolicy(Policies.IsVerified, Policies.IsVerifiedPolicy()); options.AddPolicy(Policies.IsAdmin, Policies.IsAdminPolicy()); options.AddPolicy(Policies.EditDownload, Policies.EditDownloadPolicy()); }); services.AddSingleton <IAuthorizationHandler, EditDownloadAuthorizationHandler>(); services.AddHttpContextAccessor(); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/octet-stream")); services.AddSingleton(client); services.AddSingleton(ConfigureMapper()); services.AddTransient <ISqlDataAccess, SqlDataAccess>(); services.AddTransient <IHttpDataAccess, HttpDataAccess>(); services.AddTransient <IUserTable, UserTable>(); services.AddTransient <IRoleTable, RoleTable>(); services.AddTransient <IApplicationTable, ApplicationTable>(); services.AddTransient <IUserRoleTable, UserRoleTable>(); services.AddTransient <IConnectionTable, ConnectionTable>(); services.AddTransient <IDownloadTable, DownloadTable>(); services.AddTransient <IDownloadAuthorTable, DownloadAuthorTable>(); services.AddTransient <IDownloadFileTable, DownloadFileTable>(); services.AddTransient <IDownloadFileApi, DownloadFileApi>(); services.AddTransient <IUserProcessor, UserProcessor>(); services.AddTransient <IRoleProcessor, RoleProcessor>(); services.AddTransient <IApplicationProcessor, ApplicationProcessor>(); services.AddTransient <IConnectionProcessor, ConnectionProcessor>(); services.AddTransient <IDownloadProcessor, DownloadProcessor>(); services.AddScoped <Pages.Downloads.EditDownloadState>(); }