mirror of
https://github.com/bitwarden/server.git
synced 2025-05-28 23:04:50 -05:00
add individual settings for change password uri
This commit is contained in:
parent
07390ef9fb
commit
d159067850
@ -1,4 +1,4 @@
|
||||
using Bit.Icons.Models;
|
||||
using Bit.Icons.Models;
|
||||
using Bit.Icons.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
@ -17,11 +17,24 @@ public class ChangePasswordUriController : Controller
|
||||
public ChangePasswordUriController(
|
||||
IMemoryCache memoryCache,
|
||||
IDomainMappingService domainMappingService,
|
||||
IChangePasswordUriService changePasswordService)
|
||||
IChangePasswordUriService changePasswordService,
|
||||
ChangePasswordUriSettings iconsSettings)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
_domainMappingService = domainMappingService;
|
||||
_changePasswordService = changePasswordService;
|
||||
_changePasswordSettings = iconsSettings;
|
||||
}
|
||||
|
||||
[HttpGet("config")]
|
||||
public IActionResult GetConfig()
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
_changePasswordSettings.CacheEnabled,
|
||||
_changePasswordSettings.CacheHours,
|
||||
_changePasswordSettings.CacheSizeLimit
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
|
||||
namespace Bit.Icons.Models;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Icons.Models;
|
||||
namespace Bit.Icons.Models;
|
||||
|
||||
public class ChangePasswordUriSettings
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
|
||||
namespace Bit.Icons.Services;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Icons.Extensions;
|
||||
using Bit.Icons.Models;
|
||||
using Bit.SharedWeb.Utilities;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
@ -27,8 +28,11 @@ public class Startup
|
||||
// Settings
|
||||
var globalSettings = services.AddGlobalSettingsServices(Configuration, Environment);
|
||||
var iconsSettings = new IconsSettings();
|
||||
var changePasswordUriSettings = new ChangePasswordUriSettings();
|
||||
ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings);
|
||||
ConfigurationBinder.Bind(Configuration.GetSection("ChangePasswordUriSettings"), changePasswordUriSettings);
|
||||
services.AddSingleton(s => iconsSettings);
|
||||
services.AddSingleton(s => changePasswordUriSettings);
|
||||
|
||||
// Http client
|
||||
services.ConfigureHttpClients();
|
||||
@ -41,6 +45,10 @@ public class Startup
|
||||
{
|
||||
options.SizeLimit = iconsSettings.CacheSizeLimit;
|
||||
});
|
||||
services.AddMemoryCache(options =>
|
||||
{
|
||||
options.SizeLimit = changePasswordUriSettings.CacheSizeLimit;
|
||||
});
|
||||
|
||||
// Services
|
||||
services.AddServices();
|
||||
|
@ -6,5 +6,10 @@
|
||||
"cacheEnabled": true,
|
||||
"cacheHours": 24,
|
||||
"cacheSizeLimit": null
|
||||
},
|
||||
"changePasswordUriSettings": {
|
||||
"cacheEnabled": true,
|
||||
"cacheHours": 24,
|
||||
"cacheSizeLimit": null
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user