+
+
+
+
Order History
+
+
+
+ @if (orderHistory != null)
+ {
+ @foreach (var order in orderHistory)
+ {
+
+
+
+
+
+
+
+
+
+
+
Shipped to: @order.ShippingAddressName
+
+
+
+
+
+ Total Paid
+ R @order.Total.ToString("N2")
+
+
+
+
+
+
+
+ }
+ }
+ else
+ {
+
+ Loading order history...
+
+ }
+
+
+
+
+
+
Saved Addresses
+ @if (!showAddForm && editingAddress == null)
+ {
+
+ }
+
+
+ @if (showAddForm)
{
-
-
-
-
-
-
-
-
-
-
-
Shipped to: @order.ShippingAddressName
-
-
-
-
-
- Total Paid
- R @order.Total.ToString("N2")
-
-
-
-
-
+
}
- }
- else
- {
-
- Loading order history...
-
- }
-
-
-
-
-
Saved Addresses
- @if (!showAddForm && editingAddress == null)
- {
-
- }
-
-
- @if (showAddForm)
- {
-
- }
-
- @if (editingAddress != null)
- {
-
- }
-
- @foreach (var addr in savedAddresses)
- {
-
-
-
-
@addr.Name
-
@addr.Street, @addr.City, @addr.PostalCode
-
- @if (addr.IsBilling)
- {
-
[Billing]
- }
- @if (addr.IsShipping)
- {
-
[Shipping]
- }
+ @if (editingAddress != null)
+ {
+
+ }
-
-
+ @foreach (var addr in savedAddresses)
+ {
+
+
+
+
@addr.Name
+
@addr.Street, @addr.City, @addr.PostalCode
+
+ @if (addr.IsBilling)
+ {
+ [Billing]
+ }
+ @if (addr.IsShipping)
+ {
+ [Shipping]
+ }
+
+
-
+
+
-
+
+
+
+
+
+ }
+
+
+
+
+
Profile Settings
+
+
+
Manage your password and profile data here.
- }
-
-
-
-
Profile Settings
-
-
-
Manage your password and profile data here.
-
-
-
+
+
+
+
+
+
@code {
private bool showAddForm = false;
@@ -216,6 +227,8 @@
new AddressItem { Id = 3, Name = "Midrand Books Warehouse", Street = "Unit 8, Corporate Park North", City = "Randjespark", PostalCode = "1683", IsBilling = false, IsShipping = true, IsPrimary = false }
};
+ private void TriggerLogout() => Navigation.NavigateTo("/logout", forceLoad: true);
+
private void DownloadInvoice(string orderId)
{
// Handle invoice downloading logic here
diff --git a/MidrandBookshop/Components/RedirectToLogin.razor b/MidrandBookshop/Components/RedirectToLogin.razor
new file mode 100644
index 0000000..68ff98c
--- /dev/null
+++ b/MidrandBookshop/Components/RedirectToLogin.razor
@@ -0,0 +1,10 @@
+@inject NavigationManager Navigation
+
+@code {
+ protected override void OnInitialized()
+ {
+ var returnUrl = Navigation.ToBaseRelativePath(Navigation.Uri);
+
+ Navigation.NavigateTo($"/login?redirectUri={Uri.EscapeDataString(returnUrl)}", forceLoad: true);
+ }
+}
\ No newline at end of file
diff --git a/MidrandBookshop/Components/Routes.razor b/MidrandBookshop/Components/Routes.razor
index 71c38b1..6a23f48 100644
--- a/MidrandBookshop/Components/Routes.razor
+++ b/MidrandBookshop/Components/Routes.razor
@@ -1,12 +1,20 @@
-@using MidrandBookshop.Components.Pages
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+@using Microsoft.AspNetCore.Components.Authorization
+@using MidrandBookshop.Components.Pages
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MidrandBookshop/MidrandBookshop.csproj b/MidrandBookshop/MidrandBookshop.csproj
index eed9056..fd401c4 100644
--- a/MidrandBookshop/MidrandBookshop.csproj
+++ b/MidrandBookshop/MidrandBookshop.csproj
@@ -18,13 +18,13 @@
-
+
-
+
diff --git a/MidrandBookshop/Program.cs b/MidrandBookshop/Program.cs
index a3d32c8..b2257d3 100644
--- a/MidrandBookshop/Program.cs
+++ b/MidrandBookshop/Program.cs
@@ -1,9 +1,12 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using LiteCharms.Features.MidrandBooks.Extensions;
+using Microsoft.AspNetCore.HttpOverrides;
using MidrandBookshop.Components;
using static LiteCharms.Features.Extensions.Quartz;
+AppContext.SetSwitch("Microsoft.IdentityModel.DisableTelemetry", true);
+
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
@@ -31,9 +34,19 @@ builder.Services.AddMidrandShopDatabase(builder.Configuration);
builder.Services.AddMidrandShopPostgresHealthCheck();
builder.Services.AddMidrandShopQuartzHealthCheck();
builder.Services.AddHealthChecksSupport(builder.Configuration);
+builder.Services.AddCascadingAuthenticationState();
+
+builder.Services.Configure(options =>
+{
+ options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
+ options.KnownProxies.Clear();
+});
var app = builder.Build();
+app.UseForwardedHeaders();
+app.AddSecurityEndpoints();
+
var schedulerFactory = app.Services.GetRequiredService();
var scheduler = await schedulerFactory.GetScheduler(MidrandShopSchedulerName);
diff --git a/MidrandBookshop/appsettings.json b/MidrandBookshop/appsettings.json
index cefe3b0..fb852fd 100644
--- a/MidrandBookshop/appsettings.json
+++ b/MidrandBookshop/appsettings.json
@@ -1,6 +1,8 @@
{
"AuthentikSettings": {
- "Authority": "https://id.khongisa.co.za/application/o/midrand-books-uat/"
+ "Authority": "https://id.khongisa.co.za/application/o/midrand-books-uat/",
+ "MetadataEndpoint": "https://id.khongisa.co.za/application/o/midrand-books-uat/.well-known/openid-configuration",
+ "RevokationEndpoint": "https://id.khongisa.co.za/application/o/revoke/"
},
"HasherSettings": {
"MinHashLength": 11
diff --git a/midrandbooks-uat.yml b/midrandbooks-uat.yml
index 11677e1..58211af 100644
--- a/midrandbooks-uat.yml
+++ b/midrandbooks-uat.yml
@@ -27,6 +27,8 @@ data:
ValidPayfastHosts__5: "api.payfast.co.za"
ValidPayfastHosts__6: "payment.payfast.io"
AuthentikSettings__Authority: "https://id.khongisa.co.za/application/o/midrand-books-api-uat/"
+ AuthentikSettings__MetadataEndpoint: "https://id.khongisa.co.za/application/o/midrand-books-uat/.well-known/openid-configuration"
+ AuthentikSettings__RevokationEndpoint: "https://id.khongisa.co.za/application/o/revoke/"
---
apiVersion: v1
kind: Secret