Adds PBKDF2 protection for account passwords. (#122)
This commit is contained in:
parent
1ee6830637
commit
29467a3ed9
9 changed files with 209 additions and 172 deletions
26
Projects/Scripts/Accounting/AccountSecurity.cs
Normal file
26
Projects/Scripts/Accounting/AccountSecurity.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
namespace Server.Accounting
|
||||
{
|
||||
public enum PasswordProtectionAlgorithm
|
||||
{
|
||||
PBKDF2
|
||||
}
|
||||
|
||||
public static class AccountSecurity
|
||||
{
|
||||
// TODO: Put it in a configuration
|
||||
public const PasswordProtectionAlgorithm AlgorithmName = PasswordProtectionAlgorithm.PBKDF2;
|
||||
|
||||
public static readonly IPasswordProtection CurrentPasswordProtection = GetPasswordProtection(AlgorithmName);
|
||||
|
||||
public static IPasswordProtection GetPasswordProtection(PasswordProtectionAlgorithm algorithm)
|
||||
{
|
||||
var passwordProtection = algorithm switch
|
||||
{
|
||||
PasswordProtectionAlgorithm.PBKDF2 => PBKDF2PasswordProtection.Instance,
|
||||
_ => null
|
||||
};
|
||||
|
||||
return passwordProtection;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue