// Copyright (c) Umbraco. // See LICENSE for more details. using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { /// /// Typed configuration options for security settings. /// [UmbracoOptions(Constants.Configuration.ConfigSecurity)] public class SecuritySettings { internal const bool StaticMemberBypassTwoFactorForExternalLogins = true; internal const bool StaticUserBypassTwoFactorForExternalLogins = true; internal const bool StaticKeepUserLoggedIn = false; internal const bool StaticHideDisabledUsersInBackOffice = false; internal const bool StaticAllowPasswordReset = true; internal const string StaticAuthCookieName = "UMB_UCONTEXT"; internal const string StaticAllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+\\"; /// /// Gets or sets a value indicating whether to keep the user logged in. /// [DefaultValue(StaticKeepUserLoggedIn)] public bool KeepUserLoggedIn { get; set; } = StaticKeepUserLoggedIn; /// /// Gets or sets a value indicating whether to hide disabled users in the back-office. /// [DefaultValue(StaticHideDisabledUsersInBackOffice)] public bool HideDisabledUsersInBackOffice { get; set; } = StaticHideDisabledUsersInBackOffice; /// /// Gets or sets a value indicating whether to allow user password reset. /// [DefaultValue(StaticAllowPasswordReset)] public bool AllowPasswordReset { get; set; } = StaticAllowPasswordReset; /// /// Gets or sets a value for the authorization cookie name. /// [DefaultValue(StaticAuthCookieName)] public string AuthCookieName { get; set; } = StaticAuthCookieName; /// /// Gets or sets a value for the authorization cookie domain. /// public string? AuthCookieDomain { get; set; } /// /// Gets or sets a value indicating whether the user's email address is to be considered as their username. /// public bool UsernameIsEmail { get; set; } = true; /// /// Gets or sets the set of allowed characters for a username /// [DefaultValue(StaticAllowedUserNameCharacters)] public string AllowedUserNameCharacters { get; set; } = StaticAllowedUserNameCharacters; /// /// Gets or sets a value for the user password settings. /// public UserPasswordConfigurationSettings? UserPassword { get; set; } /// /// Gets or sets a value for the member password settings. /// public MemberPasswordConfigurationSettings? MemberPassword { get; set; } /// /// 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. /// [DefaultValue(StaticMemberBypassTwoFactorForExternalLogins)] public bool MemberBypassTwoFactorForExternalLogins { get; set; } = StaticMemberBypassTwoFactorForExternalLogins; /// /// 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. /// [DefaultValue(StaticUserBypassTwoFactorForExternalLogins)] public bool UserBypassTwoFactorForExternalLogins { get; set; } = StaticUserBypassTwoFactorForExternalLogins; } }