Skip to content

Commit

Permalink
Clear response cache when values change (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmarkham authored Jan 21, 2024
1 parent 2044eb9 commit 13dcb97
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public override bool SaveSettings(CspSettings settings)
{
this.cache.Remove(Constants.SettingsCacheKey);
this.cache.Remove(Constants.PolicyCacheKey);

this.cache.Remove(Constants.ResponseHeadersCacheKey);

try
{
var id = ss.Save(settings, Identity.NewIdentity(settings.Id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public T Update<T>(T policy) where T : ResponseHeader
using (var s = GetStore())
{
// This needs to go back in as it causes the app to crash.
this.cache.Remove(Constants.PolicyCacheKey);
this.cache.Remove(Constants.ResponseHeadersCacheKey);

var _ = s.Save(new ResponseHeaderStorageItem<T>(policy));

Expand Down
4 changes: 1 addition & 3 deletions src/Sample/DemoSite/DemoSite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<!--
<PackageReference Include="Jhoose.Security.Admin" Version="2.2.0.259" />
-->

</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Sample/DemoSite/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public void ConfigureServices(IServiceCollection services)
});


//services.Configure<ProtectedModuleOptions>(p => p.RootPath = "~/ui");
//services.Configure<UIOptions>(o => o.EditUrl = new System.Uri("~/ui/CMS/", System.UriKind.Relative));
services.Configure<ProtectedModuleOptions>(p => p.RootPath = "~/ui");
services.Configure<UIOptions>(o => o.EditUrl = new System.Uri("~/ui/CMS/", System.UriKind.Relative));

services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IFirstRequestInitializer), typeof(BootstrapAdminUser)));

services.AddJhooseSecurity(_configuration, (o) =>
{
o.UseHeadersUI = true;
//o.ExclusionPaths.Add("/ui");
o.ExclusionPaths.Add("/ui");
},
configurePolicy: (p) =>
{
Expand Down

0 comments on commit 13dcb97

Please sign in to comment.