Compare commits
84
Commits
11dfd18a44
..
1.90.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d8ebffabf | ||
|
|
e2d29261da | ||
|
|
f001b02633 | ||
|
|
de955a96a8 | ||
|
|
c4d3bb4cdf | ||
|
|
cdc80db214 | ||
|
|
3847927ace | ||
|
|
c27aba1954 | ||
|
|
1c946dab26 | ||
|
|
9977cf27b9 | ||
|
|
8e9ac1e1ad | ||
|
|
16dae7c9fb | ||
|
|
f8153e86b4 | ||
|
|
84d33d3607 | ||
|
|
f51cc03327 | ||
|
|
aff6fcabf4 | ||
|
|
8140b5fe65 | ||
|
|
9285cedfa9 | ||
|
|
343874551a | ||
|
|
0eac9d533f | ||
|
|
24ba609e0c | ||
|
|
29f6d66c44 | ||
|
|
bcfc9ef962 | ||
|
|
b4e967acc9 | ||
|
|
205bbb9f3f | ||
|
|
73ef4b04a9 | ||
|
|
780415b6d4 | ||
|
|
879094073a | ||
|
|
b369dad452 | ||
|
|
c938bfec09 | ||
|
|
adc14038db | ||
|
|
61cb6c2228 | ||
|
|
e7a798b5e9 | ||
|
|
41b6b71b31 | ||
|
|
ee6beef603 | ||
|
|
1c3f3eaf0d | ||
|
|
2e77666d9e | ||
|
|
1977b6b301 | ||
|
|
0ab14d8b63 | ||
|
|
466458e230 | ||
|
|
141d32f591 | ||
|
|
d9e7f225ae | ||
|
|
6ae63e2ad1 | ||
|
|
f5efdde37c | ||
|
|
1592d5dc8f | ||
|
|
50a8a59d92 | ||
|
|
b70d9559b0 | ||
|
|
81d5e8f07c | ||
|
|
20a53942b5 | ||
|
|
9edb2aa4aa | ||
|
|
6ed023f2cf | ||
|
|
2c9f5a846c | ||
|
|
41f7c05be3 | ||
|
|
1a03355e84 | ||
|
|
7743c3178e | ||
|
|
ab3d8e6e9a | ||
|
|
db4c348288 | ||
|
|
6683234642 | ||
|
|
6ddbb9479a | ||
|
|
6c7349a0f8 | ||
|
|
e97fd6cd3f | ||
|
|
184c7c252a | ||
|
|
bfe8c458d6 | ||
|
|
e6e0475db1 | ||
|
|
5090c60797 | ||
|
|
9432252e15 | ||
|
|
47111a1a3a | ||
|
|
6eb3d50375 | ||
|
|
4deb732804 | ||
|
|
20d9387d0b | ||
|
|
9f6d0ccaa0 | ||
|
|
1acbc4d213 | ||
|
|
8c99668fac | ||
|
|
ad44f46204 | ||
|
|
49d999c1e3 | ||
|
|
9ed4777a18 | ||
|
|
0cf44f68cc | ||
|
|
41ed5a4288 | ||
|
|
bbcba5e06c | ||
|
|
502cc326dd | ||
|
|
4675d4c5fc | ||
|
|
f80bb2fff9 | ||
|
|
6767906b0d | ||
|
|
a344af4498 |
@@ -11,7 +11,7 @@
|
|||||||
<!-- Quartz Scheduler-->
|
<!-- Quartz Scheduler-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Bogus" Version="35.6.5" />
|
<PackageReference Include="Bogus" Version="35.6.5" />
|
||||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.102">
|
<PackageReference Include="Meziantou.Analyzer" Version="3.0.98">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -116,8 +116,8 @@
|
|||||||
|
|
||||||
<!-- Amazon S3 SDK -->
|
<!-- Amazon S3 SDK -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.5" />
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.3" />
|
||||||
<PackageReference Include="AWSSDK.S3" Version="4.0.24.2" />
|
<PackageReference Include="AWSSDK.S3" Version="4.0.24" />
|
||||||
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
|
||||||
<!-- global Usings -->
|
<!-- global Usings -->
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.MidrandBooks.Abstractions;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Extensions;
|
using LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
using Microsoft.VisualStudio.TestPlatform.TestHost;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.MidrandBooks.Tests.Common;
|
namespace LiteCharms.Features.MidrandBooks.Tests.Common;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace LiteCharms.Features.MidrandBooks.Abstractions;
|
|
||||||
|
|
||||||
public interface IMidrandBooks;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using LiteCharms.Features.Abstractions;
|
using LiteCharms.Features.Abstractions;
|
||||||
using LiteCharms.Features.MidrandBooks.Abstractions;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
|
|
||||||
@@ -9,15 +8,11 @@ public static class Shop
|
|||||||
{
|
{
|
||||||
var serviceType = typeof(IService);
|
var serviceType = typeof(IService);
|
||||||
|
|
||||||
var sharedImplementations = typeof(IFeatures).Assembly.GetTypes()
|
var implementations = Assembly.GetExecutingAssembly().GetTypes()
|
||||||
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
||||||
|
|
||||||
foreach (var sharedImplementation in sharedImplementations) services.AddScoped(sharedImplementation);
|
foreach (var implementation in implementations)
|
||||||
|
services.AddScoped(implementation);
|
||||||
var coreImplementations = typeof(IMidrandBooks).Assembly.GetTypes()
|
|
||||||
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
|
||||||
|
|
||||||
foreach (var coreImplementation in coreImplementations) services.AddScoped(coreImplementation);
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<!-- Quartz Scheduler-->
|
<!-- Quartz Scheduler-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Humanizer" Version="3.0.10" />
|
<PackageReference Include="Humanizer" Version="3.0.10" />
|
||||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.102">
|
<PackageReference Include="Meziantou.Analyzer" Version="3.0.98">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -136,8 +136,8 @@
|
|||||||
|
|
||||||
<!-- Amazon S3 SDK -->
|
<!-- Amazon S3 SDK -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.5" />
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.3" />
|
||||||
<PackageReference Include="AWSSDK.S3" Version="4.0.24.2" />
|
<PackageReference Include="AWSSDK.S3" Version="4.0.24" />
|
||||||
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
|
||||||
<!-- global Usings -->
|
<!-- global Usings -->
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
using LiteCharms.Features.Abstractions;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Orders.Models;
|
|
||||||
using LiteCharms.Features.MidrandBooks.Products.Models;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.MidrandBooks.Orders;
|
|
||||||
|
|
||||||
public sealed class CartService : IService
|
|
||||||
{
|
|
||||||
private Cart cart = new();
|
|
||||||
|
|
||||||
public Cart GetCart() => cart;
|
|
||||||
|
|
||||||
public void LoadCart(Cart savedCart) => cart = savedCart;
|
|
||||||
|
|
||||||
public void AddItem(ProductPrice productPrice)
|
|
||||||
{
|
|
||||||
var itemExists = false;
|
|
||||||
|
|
||||||
for (var i = 0; i < cart.Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (cart.Items[i].Price!.Id == productPrice.Id)
|
|
||||||
{
|
|
||||||
cart.Items[i].Quantity++;
|
|
||||||
cart.Items[i].Amount += productPrice.Amount;
|
|
||||||
|
|
||||||
itemExists = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!itemExists)
|
|
||||||
cart.Items.Add(new CartItem
|
|
||||||
{
|
|
||||||
Price = productPrice,
|
|
||||||
Amount = productPrice.Amount,
|
|
||||||
Quantity = 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
CalculateTotalPrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateQuantity(long productPriceId, int newQuantity)
|
|
||||||
{
|
|
||||||
if (newQuantity <= 0)
|
|
||||||
{
|
|
||||||
RemoveAllSameItem(productPriceId);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < cart.Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (cart.Items[i].Price!.Id == productPriceId)
|
|
||||||
{
|
|
||||||
var oldQuantity = cart.Items[i].Quantity;
|
|
||||||
var pricePerUnit = cart.Items[i].Price!.Amount;
|
|
||||||
|
|
||||||
cart.Items[i].Quantity = newQuantity;
|
|
||||||
cart.Items[i].Amount = pricePerUnit * newQuantity;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalculateTotalPrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveOneItem(long productPriceId)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < cart.Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (cart.Items[i].Price!.Id == productPriceId)
|
|
||||||
{
|
|
||||||
if (cart.Items[i].Quantity <= 1)
|
|
||||||
{
|
|
||||||
cart.Items.RemoveAt(i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cart.Items[i].Quantity--;
|
|
||||||
cart.Items[i].Amount -= cart.Items[i].Price!.Amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalculateTotalPrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveAllSameItem(long productPriceId)
|
|
||||||
{
|
|
||||||
if (cart.Items.Count == 0) return;
|
|
||||||
|
|
||||||
var item = cart.Items.FirstOrDefault(i => i.Price?.Id == productPriceId);
|
|
||||||
|
|
||||||
if (item is not null) cart.Items.Remove(item);
|
|
||||||
|
|
||||||
CalculateTotalPrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
if(cart.CustomerId is not null || cart.OrderId is not null)
|
|
||||||
{
|
|
||||||
cart.TotalPrice = 0;
|
|
||||||
cart.TotalVat = 0;
|
|
||||||
cart.Items.Clear();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cart = new Cart();
|
|
||||||
}
|
|
||||||
|
|
||||||
public decimal CalculateTotalPrice()
|
|
||||||
{
|
|
||||||
if (cart.Items.Count == 0) return 0;
|
|
||||||
|
|
||||||
var gross = cart.Items.Sum(i => i.Amount);
|
|
||||||
|
|
||||||
if (!cart.IsVatInclusive) cart.TotalVat = gross * cart.VatRate;
|
|
||||||
|
|
||||||
cart.TotalPrice = gross + cart.TotalVat;
|
|
||||||
|
|
||||||
return cart.TotalPrice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
namespace LiteCharms.Features.MidrandBooks.Orders.Models;
|
|
||||||
|
|
||||||
public sealed class Cart
|
|
||||||
{
|
|
||||||
public long? CustomerId { get; set; }
|
|
||||||
|
|
||||||
public long? OrderId { get; set; }
|
|
||||||
|
|
||||||
public decimal TotalPrice { get; set; }
|
|
||||||
|
|
||||||
public decimal TotalVat { get; set; }
|
|
||||||
|
|
||||||
public decimal VatRate { get; set; } = 0.15m;
|
|
||||||
|
|
||||||
public bool IsVatInclusive { get; set; } = true;
|
|
||||||
|
|
||||||
public IList<CartItem> Items { get; set; } = [];
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using LiteCharms.Features.MidrandBooks.Products.Models;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.MidrandBooks.Orders.Models;
|
|
||||||
|
|
||||||
public sealed class CartItem
|
|
||||||
{
|
|
||||||
public ProductPrice? Price { get; set; }
|
|
||||||
|
|
||||||
public long Quantity { get; set; }
|
|
||||||
|
|
||||||
public decimal Amount { get; set; }
|
|
||||||
}
|
|
||||||
@@ -136,8 +136,8 @@
|
|||||||
|
|
||||||
<!-- Amazon S3 SDK -->
|
<!-- Amazon S3 SDK -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.5" />
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.3" />
|
||||||
<PackageReference Include="AWSSDK.S3" Version="4.0.24.2" />
|
<PackageReference Include="AWSSDK.S3" Version="4.0.24" />
|
||||||
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
<ProjectReference Include="..\LiteCharms.Features\LiteCharms.Features.csproj" />
|
||||||
|
|
||||||
<!-- global Usings -->
|
<!-- global Usings -->
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"uat": {
|
"uat": {
|
||||||
"authority": "https://sts.security.khongisa.co.za",
|
"authority": "https://sts.security.khongisa.co.za",
|
||||||
"grantType": "client_credentials",
|
"grantType": "client_credentials",
|
||||||
"clientId": "midrandbooks-api-scaler-uat",
|
"clientId": "midrandbooks-api-uat",
|
||||||
"clientSecret": "secret_0a8dc1f99061590a52b1272db3a1871d2761c79fbd058b2a968911029e4b208a",
|
"clientSecret": "secret_5a36d0024980544c875447a4b052938becc3fbbb10b8b2c097310c1a53ba3c0a",
|
||||||
"scope": "midrandbooks-api"
|
"scope": "midrandbooks-api"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace LiteCharms.Features.Abstractions;
|
|
||||||
|
|
||||||
public interface IFeatures;
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
using LiteCharms.Features.Abstractions;
|
|
||||||
|
|
||||||
namespace LiteCharms.Features.Browser;
|
|
||||||
|
|
||||||
public sealed class LocalStorageService(ProtectedLocalStorage storage) : IService
|
|
||||||
{
|
|
||||||
public async ValueTask<Result> DeleteAsync(string key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await storage.DeleteAsync(key);
|
|
||||||
|
|
||||||
return Result.Ok();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<Result> SaveAsync(string key, string value)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await storage.SetAsync(key, value);
|
|
||||||
|
|
||||||
return Result.Ok();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<Result> SaveAsync<TValue>(string key, TValue value) where TValue : class
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await storage.SetAsync(key, value);
|
|
||||||
|
|
||||||
return Result.Ok();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<Result<string>> GetAsync(string key)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var retrieval = await storage.GetAsync<string>(key);
|
|
||||||
|
|
||||||
return retrieval.Success && !string.IsNullOrWhiteSpace(retrieval.Value)
|
|
||||||
? Result.Ok(retrieval.Value)
|
|
||||||
: Result.Fail($"Could not find object by key {key}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<Result<TValue>> GetAsync<TValue>(string key) where TValue : class
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var retrieval = await storage.GetAsync<TValue>(key);
|
|
||||||
|
|
||||||
return retrieval.Success && retrieval.Value is not null
|
|
||||||
? Result.Ok(retrieval.Value)
|
|
||||||
: Result.Fail($"Could not find object by key {key}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,7 @@ public static class Api
|
|||||||
public const string Books = nameof(Books);
|
public const string Books = nameof(Books);
|
||||||
public const string Payments = nameof(Payments);
|
public const string Payments = nameof(Payments);
|
||||||
|
|
||||||
public static IServiceCollection AddLiteCharmsWebSecurity(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddLiteCharmsUiSecurity(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var configSection = configuration.GetSection(nameof(LiteCharmsSettings));
|
var configSection = configuration.GetSection(nameof(LiteCharmsSettings));
|
||||||
|
|
||||||
@@ -31,8 +31,9 @@ public static class Api
|
|||||||
|
|
||||||
options.ClientId = authOptions.ClientId;
|
options.ClientId = authOptions.ClientId;
|
||||||
options.ClientSecret = authOptions.ClientSecret;
|
options.ClientSecret = authOptions.ClientSecret;
|
||||||
options.ResponseType = "code";
|
options.SignedOutCallbackPath = "/signout-callback-oidc";
|
||||||
|
|
||||||
|
options.ResponseType = "code";
|
||||||
options.SaveTokens = true;
|
options.SaveTokens = true;
|
||||||
options.GetClaimsFromUserInfoEndpoint = true;
|
options.GetClaimsFromUserInfoEndpoint = true;
|
||||||
|
|
||||||
@@ -41,27 +42,15 @@ public static class Api
|
|||||||
options.Scope.Add("profile");
|
options.Scope.Add("profile");
|
||||||
options.Scope.Add("email");
|
options.Scope.Add("email");
|
||||||
|
|
||||||
options.Events = new OpenIdConnectEvents
|
options.CorrelationCookie.SecurePolicy = CookieSecurePolicy.Always;
|
||||||
{
|
options.CorrelationCookie.SameSite = SameSiteMode.None;
|
||||||
OnRedirectToIdentityProviderForSignOut = context =>
|
options.CorrelationCookie.HttpOnly = true;
|
||||||
{
|
|
||||||
var idToken = context.ProtocolMessage.IdTokenHint;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(idToken))
|
options.NonceCookie.SecurePolicy = CookieSecurePolicy.Always;
|
||||||
{
|
options.NonceCookie.SameSite = SameSiteMode.None;
|
||||||
var tokens = context.Properties.GetTokens();
|
options.NonceCookie.HttpOnly = true;
|
||||||
var idTokenItem = tokens.FirstOrDefault(t => string.Equals(t.Name, "id_token", StringComparison.Ordinal));
|
|
||||||
|
|
||||||
if (idTokenItem != null) context.ProtocolMessage.IdTokenHint = idTokenItem.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddCascadingAuthenticationState();
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,17 +91,16 @@ public static class Api
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapGet("/logout", async (HttpContext context) =>
|
app.MapGet("/logout", async (HttpContext context, IHttpClientFactory httpClientFactory, IOptions<LiteCharmsSettings> settings) =>
|
||||||
{
|
{
|
||||||
var idToken = await context.GetTokenAsync("id_token");
|
|
||||||
|
|
||||||
var authProperties = new AuthenticationProperties { RedirectUri = "/", };
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(idToken))
|
|
||||||
authProperties.Parameters.Add("id_token_hint", idToken);
|
|
||||||
|
|
||||||
await context.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, authProperties);
|
|
||||||
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
|
||||||
|
string currentBaseUrl = $"https://{context.Request.Host}{context.Request.PathBase}/";
|
||||||
|
|
||||||
|
await context.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
||||||
|
{
|
||||||
|
RedirectUri = currentBaseUrl
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Certificate" Version="10.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.Certificate" Version="10.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.8" />
|
||||||
|
|
||||||
<Using Include="Microsoft.AspNetCore.Authentication" />
|
<Using Include="Microsoft.AspNetCore.Authentication"/>
|
||||||
<Using Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
|
<Using Include="Microsoft.AspNetCore.Authentication.OpenIdConnect"/>
|
||||||
<Using Include="Microsoft.AspNetCore.Authentication.Cookies" />
|
<Using Include="Microsoft.AspNetCore.Authentication.Cookies"/>
|
||||||
<Using Include="IdentityModel.AspNetCore.OAuth2Introspection" />
|
<Using Include="IdentityModel.AspNetCore.OAuth2Introspection"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- API Versioning -->
|
<!-- API Versioning -->
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<!-- Quartz Scheduler-->
|
<!-- Quartz Scheduler-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Hashids.net" Version="1.7.0" />
|
<PackageReference Include="Hashids.net" Version="1.7.0" />
|
||||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.102">
|
<PackageReference Include="Meziantou.Analyzer" Version="3.0.98">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -171,8 +171,8 @@
|
|||||||
|
|
||||||
<!-- Amazon S3 SDK -->
|
<!-- Amazon S3 SDK -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.5" />
|
<PackageReference Include="AWSSDK.Extensions.NetCore.Setup" Version="4.0.4.3" />
|
||||||
<PackageReference Include="AWSSDK.S3" Version="4.0.24.2" />
|
<PackageReference Include="AWSSDK.S3" Version="4.0.24" />
|
||||||
|
|
||||||
<!-- global Usings -->
|
<!-- global Usings -->
|
||||||
<Using Include="Amazon.S3" />
|
<Using Include="Amazon.S3" />
|
||||||
@@ -182,7 +182,6 @@
|
|||||||
|
|
||||||
<!-- Shared Usings -->
|
<!-- Shared Usings -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Using Include="Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage" />
|
|
||||||
<Using Include="System.Reflection" />
|
<Using Include="System.Reflection" />
|
||||||
<Using Include="Microsoft.Extensions.DependencyInjection.Extensions" />
|
<Using Include="Microsoft.Extensions.DependencyInjection.Extensions" />
|
||||||
<Using Include="Microsoft.AspNetCore.Routing" />
|
<Using Include="Microsoft.AspNetCore.Routing" />
|
||||||
|
|||||||
Reference in New Issue
Block a user