4 Commits

Author SHA1 Message Date
khwezi 2d833d3a90 Merge pull request 'Forced proto callback' (#13) from notifications into master
Reviewed-on: #13
2026-05-17 09:01:04 +02:00
Khwezi Mngoma c152018be8 Forced proto callback
continuous-integration/drone/pr Build is passing
2026-05-17 09:00:41 +02:00
khwezi aa7b3f3d68 Merge pull request 'Added support for header forwarding' (#12) from notifications into master
Reviewed-on: #12
2026-05-17 08:48:01 +02:00
Khwezi Mngoma c7f4aad99d Added support for header forwarding
continuous-integration/drone/pr Build is passing
2026-05-17 08:47:20 +02:00
2 changed files with 14 additions and 1 deletions
+12 -1
View File
@@ -1,6 +1,5 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using Microsoft.AspNetCore.Authentication;
using ShopAdmin.Components;
using static LiteCharms.Features.Email.Extensions.Constants;
@@ -78,10 +77,21 @@ builder.Services.AddAuthentication(options =>
var idToken = await callbackContext.HttpContext.GetTokenAsync("id_token");
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 schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
@@ -105,6 +115,7 @@ app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages:
app.UseHttpsRedirection();
app.UseAntiforgery();
app.UseForwardedHeaders();
app.UseAuthentication();
app.UseAuthorization();
+2
View File
@@ -57,6 +57,8 @@
<!-- Shared Global Usings -->
<ItemGroup>
<Using Include="Microsoft.AspNetCore.HttpOverrides" />
<Using Include="Microsoft.AspNetCore.Authentication" />
<Using Include="Blazored.Toast" />
<Using Include="Quartz" />
<Using Include="Mediator" />