Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d833d3a90 | |||
| c152018be8 | |||
| aa7b3f3d68 | |||
| c7f4aad99d |
+12
-1
@@ -1,6 +1,5 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Mediator;
|
using LiteCharms.Features.Mediator;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using ShopAdmin.Components;
|
using ShopAdmin.Components;
|
||||||
using static LiteCharms.Features.Email.Extensions.Constants;
|
using static LiteCharms.Features.Email.Extensions.Constants;
|
||||||
|
|
||||||
@@ -78,10 +77,21 @@ builder.Services.AddAuthentication(options =>
|
|||||||
var idToken = await callbackContext.HttpContext.GetTokenAsync("id_token");
|
var idToken = await callbackContext.HttpContext.GetTokenAsync("id_token");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(idToken)) callbackContext.ProtocolMessage.IdTokenHint = idToken;
|
if (!string.IsNullOrEmpty(idToken)) callbackContext.ProtocolMessage.IdTokenHint = idToken;
|
||||||
|
|
||||||
|
if (callbackContext.ProtocolMessage.RedirectUri.StartsWith("http://"))
|
||||||
|
{
|
||||||
|
callbackContext.ProtocolMessage.RedirectUri = callbackContext.ProtocolMessage.RedirectUri.Replace("http://", "https://");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||||
|
options.KnownProxies.Clear();
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
|
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
|
||||||
@@ -105,6 +115,7 @@ app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages:
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseAntiforgery();
|
app.UseAntiforgery();
|
||||||
|
app.UseForwardedHeaders();
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|||||||
@@ -57,6 +57,8 @@
|
|||||||
|
|
||||||
<!-- Shared Global Usings -->
|
<!-- Shared Global Usings -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Using Include="Microsoft.AspNetCore.HttpOverrides" />
|
||||||
|
<Using Include="Microsoft.AspNetCore.Authentication" />
|
||||||
<Using Include="Blazored.Toast" />
|
<Using Include="Blazored.Toast" />
|
||||||
<Using Include="Quartz" />
|
<Using Include="Quartz" />
|
||||||
<Using Include="Mediator" />
|
<Using Include="Mediator" />
|
||||||
|
|||||||
Reference in New Issue
Block a user