I'm building an application based on the .Net Core 3.1 + Angular template. The application is using Azure AD to authenticate users.
The backend is configured with this:
services.AddAuthentication(AzureADDefaults.BearerAuthenticationScheme)
.AddAzureADBearer(options => Configuration.Bind("AzureActiveDirectory", options));
The frontend is using @azure/msal-angular to redirect users at the first non authenticated call to the Api. This works well.
Now I want to secure even more the application. I would like that the angular files or any static files NOT to be downloaded when if the user is not authenticated.
How do I manage to do that ? How to protect the application on the root folder and redirect the users to the Azure AD login page if they are not authenticated ?