2020-03-16 14:02:08 +01:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2020-03-19 19:06:05 +01:00
|
|
|
|
using Umbraco.Core;
|
2020-03-16 14:02:08 +01:00
|
|
|
|
using Umbraco.Core.Configuration;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Configuration.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class UserPasswordConfigurationSettings : IUserPasswordConfiguration
|
|
|
|
|
|
{
|
2020-03-19 19:06:05 +01:00
|
|
|
|
private const string Prefix = Constants.Configuration.ConfigSecurityPrefix + "UserPassword:";
|
2020-03-16 14:02:08 +01:00
|
|
|
|
private readonly IConfiguration _configuration;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
2020-03-16 14:02:08 +01:00
|
|
|
|
public UserPasswordConfigurationSettings(IConfiguration configuration)
|
|
|
|
|
|
{
|
|
|
|
|
|
_configuration = configuration;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-19 19:06:05 +01:00
|
|
|
|
public int RequiredLength => _configuration.GetValue(Prefix + "RequiredLength", 10);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
|
|
|
|
|
public bool RequireNonLetterOrDigit =>
|
2020-03-19 19:06:05 +01:00
|
|
|
|
_configuration.GetValue(Prefix + "RequireNonLetterOrDigit", false);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
2020-03-19 19:06:05 +01:00
|
|
|
|
public bool RequireDigit => _configuration.GetValue(Prefix + "RequireDigit", false);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
|
|
|
|
|
public bool RequireLowercase =>
|
2020-03-19 19:06:05 +01:00
|
|
|
|
_configuration.GetValue(Prefix + "RequireLowercase", false);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
|
|
|
|
|
public bool RequireUppercase =>
|
2020-03-19 19:06:05 +01:00
|
|
|
|
_configuration.GetValue(Prefix + "RequireUppercase", false);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
|
|
|
|
|
public string HashAlgorithmType =>
|
2020-05-27 13:48:26 +10:00
|
|
|
|
_configuration.GetValue(Prefix + "HashAlgorithmType", Constants.Security.AspNetCoreV3PasswordHashAlgorithmName);
|
2020-03-18 11:29:29 +01:00
|
|
|
|
|
|
|
|
|
|
public int MaxFailedAccessAttemptsBeforeLockout =>
|
2020-03-19 19:06:05 +01:00
|
|
|
|
_configuration.GetValue(Prefix + "MaxFailedAccessAttemptsBeforeLockout", 5);
|
2020-03-16 14:02:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|