fix #3669 add CORS policy and use Jwt with XHR to allow file uploads to work in .NET MAUI

This commit is contained in:
sbwalker
2024-01-23 10:34:18 -05:00
parent 4816bfa26d
commit b8fe95b945
6 changed files with 32 additions and 6 deletions

View File

@ -131,6 +131,16 @@ namespace Oqtane
.WithSiteIdentity()
.WithSiteAuthentication();
services.AddCors(options =>
{
options.AddPolicy(Constants.MauiUserAgent,
policy =>
{
policy.WithOrigins("https://0.0.0.0", "http://0.0.0.0", "app://0.0.0.0")
.AllowAnyHeader().AllowCredentials();
});
});
services.AddMvc(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
@ -176,6 +186,7 @@ namespace Oqtane
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCors(Constants.MauiUserAgent);
app.UseTenantResolution();
app.UseJwtAuthorization();
app.UseBlazorFrameworkFiles();