2020-12-06 10:46:04 +01:00
// Copyright (c) Umbraco.
// See LICENSE for more details.
2021-07-05 14:27:49 +01:00
using System.ComponentModel ;
2021-02-18 11:06:02 +01:00
namespace Umbraco.Cms.Core.Configuration.Models
2020-03-16 14:02:08 +01:00
{
2020-12-06 10:46:04 +01:00
/// <summary>
/// Typed configuration options for security settings.
/// </summary>
2021-06-24 08:47:37 +02:00
[UmbracoOptions(Constants.Configuration.ConfigSecurity)]
2020-08-20 08:24:23 +01:00
public class SecuritySettings
2020-03-16 14:02:08 +01:00
{
2022-02-09 10:19:39 +01:00
internal const bool StaticMemberBypassTwoFactorForExternalLogins = true ;
internal const bool StaticUserBypassTwoFactorForExternalLogins = true ;
2021-07-05 14:27:49 +01:00
internal const bool StaticKeepUserLoggedIn = false ;
internal const bool StaticHideDisabledUsersInBackOffice = false ;
internal const bool StaticAllowPasswordReset = true ;
internal const string StaticAuthCookieName = "UMB_UCONTEXT" ;
2021-07-15 01:28:24 +01:00
internal const string StaticAllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+\\" ;
2021-07-05 14:27:49 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value indicating whether to keep the user logged in.
/// </summary>
2021-07-05 14:27:49 +01:00
[DefaultValue(StaticKeepUserLoggedIn)]
public bool KeepUserLoggedIn { get ; set ; } = StaticKeepUserLoggedIn ;
2020-03-18 11:29:29 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value indicating whether to hide disabled users in the back-office.
/// </summary>
2021-07-05 14:27:49 +01:00
[DefaultValue(StaticHideDisabledUsersInBackOffice)]
public bool HideDisabledUsersInBackOffice { get ; set ; } = StaticHideDisabledUsersInBackOffice ;
2020-03-18 11:29:29 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value indicating whether to allow user password reset.
/// </summary>
2021-07-05 14:27:49 +01:00
[DefaultValue(StaticAllowPasswordReset)]
public bool AllowPasswordReset { get ; set ; } = StaticAllowPasswordReset ;
2020-03-18 11:29:29 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value for the authorization cookie name.
/// </summary>
2021-07-05 14:27:49 +01:00
[DefaultValue(StaticAuthCookieName)]
public string AuthCookieName { get ; set ; } = StaticAuthCookieName ;
2020-03-18 11:29:29 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value for the authorization cookie domain.
/// </summary>
2021-12-16 13:44:20 +01:00
public string? AuthCookieDomain { get ; set ; }
2020-03-18 11:29:29 +01:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value indicating whether the user's email address is to be considered as their username.
/// </summary>
2020-08-20 08:24:23 +01:00
public bool UsernameIsEmail { get ; set ; } = true ;
2020-08-25 10:45:54 +02:00
2021-07-15 01:28:24 +01:00
/// <summary>
/// Gets or sets the set of allowed characters for a username
/// </summary>
[DefaultValue(StaticAllowedUserNameCharacters)]
public string AllowedUserNameCharacters { get ; set ; } = StaticAllowedUserNameCharacters ;
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value for the user password settings.
/// </summary>
2021-12-16 13:44:20 +01:00
public UserPasswordConfigurationSettings ? UserPassword { get ; set ; }
2020-08-25 10:45:54 +02:00
2020-12-06 10:46:04 +01:00
/// <summary>
/// Gets or sets a value for the member password settings.
/// </summary>
2021-12-16 13:44:20 +01:00
public MemberPasswordConfigurationSettings ? MemberPassword { get ; set ; }
2022-02-09 10:19:39 +01:00
/// <summary>
/// Gets or sets a value indicating whether to bypass the two factor requirement in Umbraco when using external login for members. Thereby rely on the External login and potential 2FA at that provider.
/// </summary>
[DefaultValue(StaticMemberBypassTwoFactorForExternalLogins)]
public bool MemberBypassTwoFactorForExternalLogins { get ; set ; } = StaticMemberBypassTwoFactorForExternalLogins ;
/// <summary>
/// Gets or sets a value indicating whether to bypass the two factor requirement in Umbraco when using external login for users. Thereby rely on the External login and potential 2FA at that provider.
/// </summary>
[DefaultValue(StaticUserBypassTwoFactorForExternalLogins)]
public bool UserBypassTwoFactorForExternalLogins { get ; set ; } = StaticUserBypassTwoFactorForExternalLogins ;
2020-03-16 14:02:08 +01:00
}
}