Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using adas_core.Domain.Models.MongoModels;
|
||||
|
||||
namespace adas_core.Domain.Models.AppSettings;
|
||||
|
||||
public class AuthSettings
|
||||
{
|
||||
public JwtConfig? JwtConfig { get; set; }
|
||||
public UsersWhiteListConfig UsersWhiteListConfig { get; set; } = [];
|
||||
public List<string> LoginMethods { get; set; } = [];
|
||||
}
|
||||
|
||||
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<string, JwtExtConfig>? ExternalProviders { get; set; } = null;
|
||||
}
|
||||
|
||||
public class JwtExtConfig
|
||||
{
|
||||
public string? Key { get; set; }
|
||||
public string? Audience { get; set; }
|
||||
public bool ValidateAudience { get; set; } = true;
|
||||
}
|
||||
|
||||
public class UsersWhiteListConfig : List<string>
|
||||
{
|
||||
public bool IsValid(User user)
|
||||
{
|
||||
return this.Any(username => username.ToLowerInvariant().Equals(user.UserName.ToLowerInvariant()));
|
||||
}
|
||||
}
|
||||
|
||||
public class ValidGroupsConfig : List<ValidGroup>
|
||||
{
|
||||
public bool IsValid(User? user)
|
||||
{
|
||||
return user != null;
|
||||
}
|
||||
}
|
||||
|
||||
public class ValidGroup
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public bool IsRegex { get; set; } = false;
|
||||
}
|
||||
Reference in New Issue
Block a user