using adas_core.Domain.Models.MongoModels; namespace adas_core.Domain.Models.AppSettings; /// /// Represents a set of configuration settings used to control authentication behavior. /// public class AuthSettings { public JwtConfig? JwtConfig { get; set; } public UsersWhiteListConfig UsersWhiteListConfig { get; set; } = []; public List LoginMethods { get; set; } = []; } /// /// Represents a JWT configuration class that extends , providing additional or specialized settings for JSON Web Token processing. /// /// /// This class derives from and inherits its configuration properties, allowing it to serve as a more specific or customized JWT configuration type. /// public class JwtConfig : JwtExtConfig { public string? Issuer { get; set; } public bool ValidateIssuer { get; set; } = true; public int TokenValidityInMinutes { get; set; } = 10; public int RefreshTokenValidityInMinutes { get; set; } = 1440; public Dictionary? ExternalProviders { get; set; } = null; } /// /// Represents a configuration class for JWT (JSON Web Token) extension settings. /// public class JwtExtConfig { public string? Key { get; set; } public string? Audience { get; set; } public bool ValidateAudience { get; set; } = true; } /// /// Represents a configuration collection that defines a whitelist of users, stored as a list of string identifiers. /// /// /// Inherits from a generic list of strings, exposing standard collection semantics for the whitelisted user entries. /// public class UsersWhiteListConfig : List { /// /// Determines whether the collection contains a username matching the specified user's username, using a case-insensitive comparison. /// /// The user whose username will be checked against the collection. /// true if a matching username is found; otherwise, false. public bool IsValid(User user) { return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant())); } } /// /// Represents a configuration collection of instances, exposing them as a strongly-typed list. /// /// /// This type inherits from where T is , providing standard list operations for managing the configured valid groups. /// /// /// Represents a validation group used to organize or aggregate related validation rules. /// /// /// This type serves as a container or marker for grouping validation logic within a broader validation framework. /// public class ValidGroupsConfig : List { /// /// Determines whether the specified user is considered valid by checking that it is not null. /// /// The user instance to validate. /// if is not null; otherwise, . public bool IsValid(User? user) { return user != null; } } public class ValidGroup { public string? Name { get; set; } public bool IsRegex { get; set; } = false; }