public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IKernel di, ILoggerFactory loggerFactory, IServiceProvider serviceProvider) { loggerFactory.AddDBLogger(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Vue/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "vue", pattern: "/{page?}", defaults: new { controller = "Vue", action = "Index" }); endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}"); endpoints.MapHub <RoomsHub>("/hub/rooms"); endpoints.MapHub <GameHub>("/hub/room"); }); //init db using (var dbinit = di.Get <DBInitializer>()) { dbinit.Initialize(); } //init hubs HubsInitializer.InitializeContextsHub(serviceProvider); di.Get <Core.Services.Process.ProcessController>().StartProcessor(); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IdentityDbContext dbContext) { loggerFactory.AddDBLogger(Configuration.GetConnectionString("managerConnection"), Configuration["LogLevel"]); // Enable development environment exception page. if (env.IsDevelopment()) { //app.UseDeveloperExceptionPage(); //// dbContext.Database.Migrate(); ////CORS // Comment the following when releasing //app.UseCors(b => b.WithOrigins("http://localhost:55904/") app.UseCors(b => b.WithOrigins("http://52.0.39.249/") .AllowAnyOrigin() .AllowCredentials() .AllowAnyMethod() .AllowAnyHeader()); } // Enable static files (assets to be served etc.) app.UseStaticFiles(); //Identity //app.UseIdentity(); //obsolete replaced with app.UseAuthentication(); app.UseAuthentication(); //routes app.UseMvc( routes => { // Pages routes.MapRoute("homepage", "", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute("logpage", "logs", defaults: new { controller = "Home", action = "Logs" }); routes.MapRoute("downloadpage", "download", defaults: new { controller = "Home", action = "Download" }); // Test // routes.MapRoute("api-getbyid", "api/v1/getbyid", defaults: new { controller = "Api", action = "GetById" }); // Partners // routes.MapRoute("api-partners-getbyid", "api/v1/partners/get/{id}", defaults: new { controller = "PartnerApi", action = "GetById" }); routes.MapRoute("api-partners-getall", "api/v1/partners/fetch", defaults: new { controller = "PartnerApi", action = "GetAll" }); routes.MapRoute("api-partners-getallp", "api/v1/partners/fetchp/{i}", defaults: new { controller = "PartnerApi", action = "GetAllPaged" }); // routes.MapRoute("api-partners-delete", "api/v1/partners/delete/{id}", defaults: new { controller = "PartnerApi", action = "Delete" }); routes.MapRoute("api-partners-add", "api/v1/partners/add", defaults: new { controller = "PartnerApi", action = "Add" }); // routes.MapRoute("api-partners-update", "api/v1/partners/update", defaults: new { controller = "PartnerApi", action = "Update" }); // Enterprise Clients // routes.MapRoute("api-ec-getbyid", "api/v1/ec/get/{id}", defaults: new { controller = "EnterpriseClientApi", action = "GetById" }); routes.MapRoute("api-ec-getall", "api/v1/ec/fetch", defaults: new { controller = "EnterpriseClientApi", action = "GetAll" }); routes.MapRoute("api-ec-getallp", "api/v1/ec/fetchp/{i}", defaults: new { controller = "EnterpriseClientApi", action = "GetAllPaged" }); // routes.MapRoute("api-ec-delete", "api/v1/ec/delete/{id}", defaults: new { controller = "EnterpriseClientApi", action = "Delete" }); routes.MapRoute("api-ec-add", "api/v1/ec/add", defaults: new { controller = "EnterpriseClientApi", action = "Add" }); // routes.MapRoute("api-ec-update", "api/v1/ec/update", defaults: new { controller = "EnterpriseClientApi", action = "Update" }); routes.MapRoute("api-ec-getbypartnerid", "api/v1/ec/getbypid/{id}", defaults: new { controller = "EnterpriseClientApi", action = "GetByPartnerId" }); // Subscriptions routes.MapRoute("api-sub-getbyid", "api/v1/sub/get/{id}", defaults: new { controller = "SubscriptionApi", action = "GetById" }); routes.MapRoute("api-sub-getall", "api/v1/sub/fetch", defaults: new { controller = "SubscriptionApi", action = "GetAll" }); routes.MapRoute("api-sub-getallp", "api/v1/sub/fetchp/{i}", defaults: new { controller = "SubscriptionApi", action = "GetAllPaged" }); //routes.MapRoute("api-sub-delete", "api/v1/sub/delete/{id}", defaults: new { controller = "SubscriptionApi", action = "Delete" }); routes.MapRoute("api-sub-add", "api/v1/sub/add", defaults: new { controller = "SubscriptionApi", action = "AddAsync" }); // routes.MapRoute("api-sub-update", "api/v1/sub/update", defaults: new { controller = "SubscriptionApi", action = "Update" }); routes.MapRoute("api-sub-cancel", "api/v1/sub/cancel", defaults: new { controller = "SubscriptionApi", action = "Cancel" }); routes.MapRoute("api-sub-setseatcount", "api/v1/sub/setseatcount", defaults: new { controller = "SubscriptionApi", action = "SetSeatCount" }); routes.MapRoute("api-sub-sendinstructions", "api/v1/sub/sendinstructions", defaults: new { controller = "SubscriptionApi", action = "SendInstructions" }); routes.MapRoute("api-sub-auth", "api/v1/sub/auth", defaults: new { controller = "SubscriptionApi", action = "Auth" }); // Users routes.MapRoute("api-user-getbyid", "api/v1/user/get/{id}", defaults: new { controller = "UserApi", action = "GetById" }); routes.MapRoute("api-user-getbyname", "api/v1/user/getfullname", defaults: new { controller = "UserApi", action = "GetFullName" }); routes.MapRoute("api-user-getall", "api/v1/user/fetch", defaults: new { controller = "UserApi", action = "GetAll" }); routes.MapRoute("api-user-getallp", "api/v1/user/fetchp", defaults: new { controller = "UserApi", action = "GetAllPaged" }); routes.MapRoute("api-user-add", "api/v1/user/add", defaults: new { controller = "UserApi", action = "Add" }); routes.MapRoute("api-user-delete", "api/v1/user/delete", defaults: new { controller = "UserApi", action = "Delete" }); routes.MapRoute("api-user-lock", "api/v1/user/lock", defaults: new { controller = "UserApi", action = "Lock" }); routes.MapRoute("api-user-unlock", "api/v1/user/unlock", defaults: new { controller = "UserApi", action = "UnLock" }); routes.MapRoute("api-user-verifyemail", "api/v1/user/verifyetoken", defaults: new { controller = "UserApi", action = "VerifyEmailToken" }); routes.MapRoute("api-user-sendreset", "api/v1/user/sendreset", defaults: new { controller = "UserApi", action = "SendResetPassword" }); routes.MapRoute("api-user-confirmreset", "api/v1/user/confirmreset", defaults: new { controller = "UserApi", action = "ConfirmResetPassword" }); routes.MapRoute("api-user-sendwelcome", "api/v1/user/sendwelcome", defaults: new { controller = "UserApi", action = "SendWelcomeEmail" }); // Lookup routes.MapRoute("api-lookup-getallproducts", "api/v1/lookup/product/fetch", defaults: new { controller = "LookupApi", action = "GetAllProducts" }); routes.MapRoute("api-lookup-getalllicenceenviornments", "api/v1/lookup/le/fetch", defaults: new { controller = "LookupApi", action = "GetAllLicenceEnvironments" }); // Licence routes.MapRoute("api-licence-getlicence", "api/v1/lic/getdetail", defaults: new { controller = "LicenceApi", action = "GetLicenceSummaryAsync" }); routes.MapRoute("api-licence-deseat", "api/v1/lic/deseat", defaults: new { controller = "LicenceApi", action = "DeactivateSeatAsync" }); //Dashboard routes.MapRoute("api-dashboard-get", "api/v1/dashboard/get", defaults: new { controller = "DashboardApi", action = "GetAll" }); //UserData routes.MapRoute("api-userdata-add", "api/v1/userdata/add", defaults: new { controller = "UserDataApi", action = "Add" }); routes.MapRoute("api-userdata-fetch", "api/v1/userdata/fetch", defaults: new { controller = "UserDataApi", action = "GetAll" }); //Report routes.MapRoute("api-report-fetch", "api/v1/report/fetch/{s}", defaults: new { controller = "ReportApi", action = "Fetch" }); routes.MapRoute("api-report-fetchbydate", "api/v1/report/fetch/{s}/{d}", defaults: new { controller = "ReportApi", action = "FetchByDate" }); routes.MapRoute("api-report-fetchp", "api/v1/report/fetchp", defaults: new { controller = "ReportApi", action = "FetchPaged" }); routes.MapRoute("api-report-start", "api/v1/report/start", defaults: new { controller = "ReportApi", action = "TriggerReportService" }); routes.MapRoute("api-report-getruns", "api/v1/report/getruns", defaults: new { controller = "ReportApi", action = "GetReportProcessorRuns" }); // Identity routes.MapRoute("api-memberhsip-createuser", "api/v1/identity/adduser", defaults: new { controller = "IdentityApi", action = "CreateUser" }); routes.MapRoute("api-memberhsip-createrole", "api/v1/identity/addrole", defaults: new { controller = "IdentityApi", action = "CreateRole" }); routes.MapRoute("api-memberhsip-assignrole", "api/v1/identity/assignrole", defaults: new { controller = "IdentityApi", action = "AssignUserToRole" }); // Token routes.MapRoute("api-token-createuser", "api/v1/token/get", defaults: new { controller = "TokenApi", action = "Get" }); routes.MapRoute("api-token-regenerate", "api/v1/token/regenerate", defaults: new { controller = "TokenApi", action = "RegenerateAsync" }); // Configuration routes.MapRoute("api-cfg-getpagesize", "api/v1/cfg/pagesize", defaults: new { controller = "ConfigurationApi", action = "GetPageSize" }); // Seat routes.MapRoute("api-seat-fetchp", "api/v1/seat/fetchp", defaults: new { controller = "SeatApi", action = "GetAllPaged" }); // ekey routes.MapRoute("api-ekey-getkey", "api/v1/ekey/getkey/{subId}", defaults: new { controller = "EKeyApi", action = "GetKey" }); routes.MapRoute("api-ekey-testencrypt", "api/v1/ekey/testencrypt", defaults: new { controller = "EKeyApi", action = "TestEncrypt" }); routes.MapRoute("api-ekey-testdecrypt", "api/v1/ekey/testdecrypt", defaults: new { controller = "EKeyApi", action = "TestDecrypt" }); //Device Events routes.MapRoute("api-device-info", "api/v1/device/info", defaults: new { controller = "DeviceApi", action = "DeviceInformationEventsAsync" }); routes.MapRoute("api-device-webprotect", "api/v1/device/webprotect", defaults: new { controller = "DeviceApi", action = "WebProtectEventAsync" }); routes.MapRoute("api-device-health", "api/v1/device/health", defaults: new { controller = "DeviceApi", action = "DeviceHealthEventAsync" }); routes.MapRoute("api-device-scansummary", "api/v1/device/scansummary", defaults: new { controller = "DeviceApi", action = "ScanSummaryEventAsync" }); routes.MapRoute("api-device-malwaredetect", "api/v1/device/malwaredetect", defaults: new { controller = "DeviceApi", action = "MalwareDetectionEventAsync" }); routes.MapRoute("api-device-secureapps", "api/v1/device/secureapps", defaults: new { controller = "DeviceApi", action = "SecureAppsEventAsync" }); routes.MapRoute("api-device-malwareremediate", "api/v1/device/malwareremediate", defaults: new { controller = "DeviceApi", action = "MalwareRemediationEventAsync" }); routes.MapRoute("api-device-realtimeprotect", "api/v1/device/realtimeprotect", defaults: new { controller = "DeviceApi", action = "RealtimeProtectionEventAsync" }); routes.MapRoute("api-device-firewallevent", "api/v1/device/firewallevent", defaults: new { controller = "DeviceApi", action = "FirewallEventAsync" }); routes.MapRoute("api-device-firewallpolicy", "api/v1/device/firewallpolicy", defaults: new { controller = "DeviceApi", action = "FirewallPolicyEventAsync" }); } ); }