We have existing ASP.NET Core application(.NET 5) which uses angular as UI framework.
We created a Blazor WASM client library which we want to use in this application alongside with already existing angular framework.
Following documentations this is how we configured it in Startup.Configure
method to "serve" balzor app from the dedicated directory "blazor-app" in wwwroot.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ...
app.UseBlazorFrameworkFiles("/blazor-app");
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapFallbackToFile("blazor-app/index.html");
});
}
How we can configure Blazor app, so it's index.html is returned only for authenticated users?
For example something like this?
[Authorize]
public class ClientController
{
public IActionResult ClientApp()
{
// returns Blazor app index.html
}
}