-
-
Save An0d/46d2e5d5fab229f744669c4676adc07b to your computer and use it in GitHub Desktop.
Umbraco9 & Hangfire with Member 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.AddAuthorization(configure => configure.AddPolicy("HangfirePolicy", configurePolicy => | |
{ | |
configurePolicy.RequireAuthenticatedUser(); | |
})); | |
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 /hangfire | |
u.EndpointRouteBuilder.MapHangfireDashboardWithAuthorizationPolicy("HangfirePolicy"); | |
u.UseInstallerEndpoints(); | |
u.UseBackOfficeEndpoints(); | |
}); | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment