-
-
Save An0d/497766f14b452b278c8f4dfa3ac74c16 to your computer and use it in GitHub Desktop.
Umbraco9 & Hangfire with BackOffice User access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
... | |
#pragma warning disable IDE0022 // Use expression body for methods | |
services.AddUmbraco(_env, _config) | |
.AddBackOffice() | |
.AddComposers() | |
.Build(); | |
#pragma warning restore IDE0022 // Use expression body for methods | |
services.AddHangfireServer(); | |
services.AddHangfire(config => | |
{ | |
config.UseSqlServerStorage(connectionString); | |
}); | |
... | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
... | |
app.UseUmbraco() | |
.WithMiddleware(u => | |
{ | |
u.UseBackOffice(); | |
}).WithEndpoints(u => | |
{ | |
// Hangfire url /umbraco/backoffice/hangfire | |
u.EndpointRouteBuilder.MapHangfireDashboardWithAuthorizationPolicy(AuthorizationPolicies.BackOfficeAccess, "/umbraco/backoffice/hangfire"); | |
u.UseInstallerEndpoints(); | |
u.UseBackOfficeEndpoints(); | |
}); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment